mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
Make wmaker XRandR aware
This patch makes wmaker automatically Restart() to take into account resolution changes done by xrandr. The motivation to write this patch is that when I start my laptop connected to an external monitor (VGA1), the resolution in the monitor is initially wrong (perhaps this is a bug in XOrg or OpenSuse, but anyway), so I always do this after starting wmaker: xrandr --output VGA1 --preferred The resolution in the external monitor gets fixed, but wmaker does not recognize the change automatically and I have to manually restart it. So this patch avoids the last step by making wmaker be XRandR-aware. Wmaker now restarts automatically when it receives a RRChangeScreenNotify event and I don't have to do the last part of the silly procedure described above. I am not sure if restarting wmaker is the most elegant solution, but it at least solves part of my issue with wmaker + xrandr.
This commit is contained in:
16
configure.ac
16
configure.ac
@@ -480,6 +480,21 @@ if test "$shape" = yes; then
|
|||||||
shape=no, $XLFLAGS $XLIBS)
|
shape=no, $XLFLAGS $XLIBS)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl XRandR support
|
||||||
|
dnl =============
|
||||||
|
xrandr=yes
|
||||||
|
AC_ARG_ENABLE(XRandR,
|
||||||
|
[ --disable-xrandr disable XRandR window extension support],
|
||||||
|
xrandr=$enableval, xrandr=yes)
|
||||||
|
|
||||||
|
added_xext=no
|
||||||
|
|
||||||
|
if test "$xrandr" = yes; then
|
||||||
|
AC_CHECK_LIB(Xrandr, XRRQueryExtension, [XLIBS="-lXrandr $XLIBS"
|
||||||
|
added_xext=yes
|
||||||
|
AC_DEFINE(HAVE_XRANDR, 1, [define if you want support for XRandR (set by configure)])],
|
||||||
|
xrandr=no, $XLFLAGS $XLIBS)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl libWINGS uses math functions, check whether usage requires linking
|
dnl libWINGS uses math functions, check whether usage requires linking
|
||||||
@@ -1072,6 +1087,7 @@ echo "Use assembly routines for wrlib : $asm_support"
|
|||||||
echo "Use inline MMX(tm) x86 assembly : $mmx_support"
|
echo "Use inline MMX(tm) x86 assembly : $mmx_support"
|
||||||
echo "Antialiased text support in WINGs : $xft"
|
echo "Antialiased text support in WINGs : $xft"
|
||||||
echo "Xinerama extension support : $xinerama"
|
echo "Xinerama extension support : $xinerama"
|
||||||
|
echo "XRandR extension support : $xrandr"
|
||||||
echo "Translated message files to install : $mof"
|
echo "Translated message files to install : $mof"
|
||||||
dnl echo "Supported languages beside English : $languages"
|
dnl echo "Supported languages beside English : $languages"
|
||||||
if test "x$MOFILES" != "x"; then
|
if test "x$MOFILES" != "x"; then
|
||||||
|
|||||||
13
src/event.c
13
src/event.c
@@ -40,6 +40,10 @@
|
|||||||
#include "xdnd.h"
|
#include "xdnd.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
#endif /* KEEP_XKB_LOCK_STATUS */
|
||||||
@@ -96,6 +100,11 @@ extern int wShapeEventBase;
|
|||||||
extern int wXkbEventBase;
|
extern int wXkbEventBase;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
extern Bool has_randr;
|
||||||
|
extern int randr_event_base;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* special flags */
|
/* special flags */
|
||||||
/*extern char WDelayedActionSet;*/
|
/*extern char WDelayedActionSet;*/
|
||||||
|
|
||||||
@@ -562,6 +571,10 @@ static void handleExtensions(XEvent * event)
|
|||||||
handleXkbIndicatorStateNotify(event);
|
handleXkbIndicatorStateNotify(event);
|
||||||
}
|
}
|
||||||
#endif /*KEEP_XKB_LOCK_STATUS */
|
#endif /*KEEP_XKB_LOCK_STATUS */
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
if (has_randr && event->type == (randr_event_base + RRScreenChangeNotify))
|
||||||
|
Restart(NULL,True);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleMapRequest(XEvent * ev)
|
static void handleMapRequest(XEvent * ev)
|
||||||
|
|||||||
@@ -143,6 +143,11 @@ Bool wXkbSupported;
|
|||||||
int wXkbEventBase;
|
int wXkbEventBase;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
Bool has_randr;
|
||||||
|
int randr_event_base;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* special flags */
|
/* special flags */
|
||||||
char WProgramSigState = 0;
|
char WProgramSigState = 0;
|
||||||
char WProgramState = WSTATE_NORMAL;
|
char WProgramState = WSTATE_NORMAL;
|
||||||
|
|||||||
12
src/screen.c
12
src/screen.c
@@ -35,9 +35,11 @@
|
|||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
#endif /* KEEP_XKB_LOCK_STATUS */
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <wraster.h>
|
#include <wraster.h>
|
||||||
|
|
||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
#include "def_pixmaps.h"
|
#include "def_pixmaps.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
@@ -77,6 +79,9 @@ extern int wScreenCount;
|
|||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
extern int wXkbSupported;
|
extern int wXkbSupported;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
extern int has_randr;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern WDDomain *WDWindowMaker;
|
extern WDDomain *WDWindowMaker;
|
||||||
|
|
||||||
@@ -598,6 +603,11 @@ WScreen *wScreenInit(int screen_number)
|
|||||||
}
|
}
|
||||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
#endif /* KEEP_XKB_LOCK_STATUS */
|
||||||
|
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
if (has_randr)
|
||||||
|
XRRSelectInput(dpy, scr->root_win, RRScreenChangeNotifyMask);
|
||||||
|
#endif
|
||||||
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
XSetErrorHandler(oldHandler);
|
XSetErrorHandler(oldHandler);
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,9 @@
|
|||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
#include "GNUstep.h"
|
#include "GNUstep.h"
|
||||||
@@ -97,6 +100,11 @@ extern Bool wXkbSupported;
|
|||||||
extern int wXkbEventBase;
|
extern int wXkbEventBase;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
extern Bool has_randr;
|
||||||
|
extern int randr_event_base;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* contexts */
|
/* contexts */
|
||||||
extern XContext wWinContext;
|
extern XContext wWinContext;
|
||||||
extern XContext wAppWinContext;
|
extern XContext wAppWinContext;
|
||||||
@@ -501,7 +509,7 @@ static char *atomNames[] = {
|
|||||||
void StartUp(Bool defaultScreenOnly)
|
void StartUp(Bool defaultScreenOnly)
|
||||||
{
|
{
|
||||||
struct sigaction sig_action;
|
struct sigaction sig_action;
|
||||||
int j, max;
|
int j, max, dummy;
|
||||||
Atom atom[sizeof(atomNames) / sizeof(char *)];
|
Atom atom[sizeof(atomNames) / sizeof(char *)];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -692,6 +700,12 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
wShapeSupported = XShapeQueryExtension(dpy, &wShapeEventBase, &j);
|
wShapeSupported = XShapeQueryExtension(dpy, &wShapeEventBase, &j);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_XRANDR
|
||||||
|
has_randr = XRRQueryExtension(dpy, &randr_event_base, &dummy);
|
||||||
|
#else
|
||||||
|
has_randr = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
wXkbSupported = XkbQueryExtension(dpy, NULL, &wXkbEventBase, NULL, NULL, NULL);
|
wXkbSupported = XkbQueryExtension(dpy, NULL, &wXkbEventBase, NULL, NULL, NULL);
|
||||||
if (wPreferences.modelock && !wXkbSupported) {
|
if (wPreferences.modelock && !wXkbSupported) {
|
||||||
|
|||||||
Reference in New Issue
Block a user