Author: manolo
Date: 2011-09-30 07:46:08 -0700 (Fri, 30 Sep 2011)
New Revision: 9102
Log:
Fix STR#2600 : screens configuration changes are now detected under all
platforms.
Requires the RandR X extension.
Modified:
branches/branch-1.3/configh.in
branches/branch-1.3/configure.in
branches/branch-1.3/src/Fl.cxx
branches/branch-1.3/src/Fl_x.cxx
Modified: branches/branch-1.3/configh.in
===================================================================
--- branches/branch-1.3/configh.in 2011-09-30 13:09:06 UTC (rev 9101)
+++ branches/branch-1.3/configh.in 2011-09-30 14:46:08 UTC (rev 9102)
@@ -84,6 +84,14 @@
#define HAVE_XINERAMA 0
/*
+ * HAVE_XRANDR
+ *
+ * Do we have the Xrandr library to support runtime update of multi-head
displays?
+ */
+
+#define HAVE_XRANDR 0
+
+/*
* USE_XFT
*
* Use the new Xft library to draw anti-aliased text.
Modified: branches/branch-1.3/configure.in
===================================================================
--- branches/branch-1.3/configure.in 2011-09-30 13:09:06 UTC (rev 9101)
+++ branches/branch-1.3/configure.in 2011-09-30 14:46:08 UTC (rev 9102)
@@ -997,6 +997,16 @@
LIBS="-lXext $LIBS")
fi
+ dnl Check for the XRandR extension unless disabled...
+ AC_ARG_ENABLE(xrandr, [ --enable-xrandr turn on XRandR
support [default=yes]])
+
+ if test x$enable_xrandr != xno; then
+ AC_CHECK_HEADER(X11/extensions/Xrandr.h, AC_DEFINE(HAVE_XRANDR),,
+ [#include <X11/Xlib.h>])
+ AC_CHECK_LIB(Xrandr, XRRQueryExtension,
+ LIBS="-lXrandr $LIBS")
+ fi
+
dnl Check for overlay visuals...
AC_PATH_PROG(XPROP, xprop)
AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
@@ -1330,6 +1340,9 @@
if test x$enable_xdbe != xno; then
graphics="$graphics+Xdbe"
fi
+ if test x$enable_xrandr != xno; then
+ graphics="$graphics+Xrandr"
+ fi
if test x$enable_xinerama != xno; then
graphics="$graphics+Xinerama"
fi
Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx 2011-09-30 13:09:06 UTC (rev 9101)
+++ branches/branch-1.3/src/Fl.cxx 2011-09-30 14:46:08 UTC (rev 9102)
@@ -778,7 +778,7 @@
- \ref FL_SHORTCUT events that are not recognized by any widget.
This lets you provide global shortcut keys.
- - \ref FL_SCREEN_CONFIGURATION_CHANGED events (not implemented on the X11
platform).
+ - \ref FL_SCREEN_CONFIGURATION_CHANGED events.
- System events that FLTK does not recognize. See fl_xevent.
- \e Some other events when the widget FLTK selected returns
zero from its handle() method. Exactly which ones may change
Modified: branches/branch-1.3/src/Fl_x.cxx
===================================================================
--- branches/branch-1.3/src/Fl_x.cxx 2011-09-30 13:09:06 UTC (rev 9101)
+++ branches/branch-1.3/src/Fl_x.cxx 2011-09-30 14:46:08 UTC (rev 9102)
@@ -43,6 +43,10 @@
# include <X11/Xlocale.h>
# include <X11/Xlib.h>
# include <X11/keysym.h>
+#ifdef HAVE_XRANDR
+#include <X11/extensions/Xrandr.h>
+static int randrEventBase = -1;
+#endif
static Fl_Xlib_Graphics_Driver fl_xlib_driver;
static Fl_Display_Device fl_xlib_display(&fl_xlib_driver);
@@ -587,6 +591,7 @@
fl_open_display(d);
}
+
void fl_open_display(Display* d) {
fl_display = d;
@@ -637,6 +642,12 @@
#if !USE_COLORMAP
Fl::visual(FL_RGB);
#endif
+#ifdef HAVE_XRANDR
+ int error_base;
+ if (XRRQueryExtension(d, &randrEventBase, &error_base))
+ XRRSelectInput(d, RootWindow(d, fl_screen), RRScreenChangeNotifyMask);
+ else randrEventBase = -1;
+#endif
}
void fl_close_display() {
@@ -920,7 +931,16 @@
if ( XFilterEvent((XEvent *)&xevent, 0) )
return(1);
-
+
+#ifdef HAVE_XRANDR
+ if( randrEventBase >= 0 && xevent.type == randrEventBase +
RRScreenChangeNotify) {
+ XRRUpdateConfiguration (&xevent);
+ Fl::call_screen_init();
+ fl_init_workarea();
+ Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL);
+ }
+#endif
+
switch (xevent.type) {
case KeymapNotify:
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit