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

@@ -45,6 +45,9 @@
#ifdef KEEP_XKB_LOCK_STATUS
#include <X11/XKBlib.h>
#endif
#ifdef HAVE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
#include "WindowMaker.h"
#include "GNUstep.h"
@@ -97,6 +100,11 @@ extern Bool wXkbSupported;
extern int wXkbEventBase;
#endif
#ifdef HAVE_XRANDR
extern Bool has_randr;
extern int randr_event_base;
#endif
/* contexts */
extern XContext wWinContext;
extern XContext wAppWinContext;
@@ -501,7 +509,7 @@ static char *atomNames[] = {
void StartUp(Bool defaultScreenOnly)
{
struct sigaction sig_action;
int j, max;
int j, max, dummy;
Atom atom[sizeof(atomNames) / sizeof(char *)];
/*
@@ -692,6 +700,12 @@ void StartUp(Bool defaultScreenOnly)
wShapeSupported = XShapeQueryExtension(dpy, &wShapeEventBase, &j);
#endif
#ifdef HAVE_XRANDR
has_randr = XRRQueryExtension(dpy, &randr_event_base, &dummy);
#else
has_randr = false;
#endif
#ifdef KEEP_XKB_LOCK_STATUS
wXkbSupported = XkbQueryExtension(dpy, NULL, &wXkbEventBase, NULL, NULL, NULL);
if (wPreferences.modelock && !wXkbSupported) {