1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +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:
Carlos R. Mafra
2010-08-22 19:05:07 +02:00
parent f6b7178542
commit c201e1612c
5 changed files with 60 additions and 2 deletions

View File

@@ -40,6 +40,10 @@
#include "xdnd.h"
#endif
#ifdef HAVE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
#ifdef KEEP_XKB_LOCK_STATUS
#include <X11/XKBlib.h>
#endif /* KEEP_XKB_LOCK_STATUS */
@@ -96,6 +100,11 @@ extern int wShapeEventBase;
extern int wXkbEventBase;
#endif
#ifdef HAVE_XRANDR
extern Bool has_randr;
extern int randr_event_base;
#endif
/* special flags */
/*extern char WDelayedActionSet;*/
@@ -562,6 +571,10 @@ static void handleExtensions(XEvent * event)
handleXkbIndicatorStateNotify(event);
}
#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)