Make wmaker XRandR aware
[wmaker-crm.git] / src / event.c
index 4f1287c..5d80fbe 100644 (file)
 #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)