mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 21:38:00 +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:
12
src/screen.c
12
src/screen.c
@@ -35,9 +35,11 @@
|
||||
#ifdef KEEP_XKB_LOCK_STATUS
|
||||
#include <X11/XKBlib.h>
|
||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
||||
#ifdef HAVE_XRANDR
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#endif
|
||||
|
||||
#include <wraster.h>
|
||||
|
||||
#include "WindowMaker.h"
|
||||
#include "def_pixmaps.h"
|
||||
#include "screen.h"
|
||||
@@ -77,6 +79,9 @@ extern int wScreenCount;
|
||||
#ifdef KEEP_XKB_LOCK_STATUS
|
||||
extern int wXkbSupported;
|
||||
#endif
|
||||
#ifdef HAVE_XRANDR
|
||||
extern int has_randr;
|
||||
#endif
|
||||
|
||||
extern WDDomain *WDWindowMaker;
|
||||
|
||||
@@ -598,6 +603,11 @@ WScreen *wScreenInit(int screen_number)
|
||||
}
|
||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
||||
|
||||
#ifdef HAVE_XRANDR
|
||||
if (has_randr)
|
||||
XRRSelectInput(dpy, scr->root_win, RRScreenChangeNotifyMask);
|
||||
#endif
|
||||
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(oldHandler);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user