Author: matt
Date: 2010-11-17 03:28:58 -0800 (Wed, 17 Nov 2010)
New Revision: 7866
Log:
Improved support for faulty X11 clients (STR #2385)
Modified:
branches/branch-1.3/CHANGES
branches/branch-1.3/src/Fl_x.cxx
Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2010-11-17 11:13:57 UTC (rev 7865)
+++ branches/branch-1.3/CHANGES 2010-11-17 11:28:58 UTC (rev 7866)
@@ -1,5 +1,6 @@
CHANGES IN FLTK 1.3.0
+ - Improved support for faulty X11 clients (STR #2385)
- Fixed xclass support for Fl_Window (STR #2053)
- Fixed Caps Lock handling in X11/XIM (STR #2366)
- Fixed handling of missing fonts in Xft (STR #2355)
Modified: branches/branch-1.3/src/Fl_x.cxx
===================================================================
--- branches/branch-1.3/src/Fl_x.cxx 2010-11-17 11:13:57 UTC (rev 7865)
+++ branches/branch-1.3/src/Fl_x.cxx 2010-11-17 11:28:58 UTC (rev 7866)
@@ -804,6 +804,27 @@
static char unknown[] = "<unknown>";
const int unknown_len = 10;
+extern "C" {
+
+static int xerror = 0;
+
+static int ignoreXEvents(Display *display, XErrorEvent *event) {
+ xerror = 1;
+ return 0;
+}
+
+static XErrorHandler catchXExceptions() {
+ xerror = 0;
+ return ignoreXEvents;
+}
+
+static int wasXExceptionRaised() {
+ return xerror;
+}
+
+}
+
+
int fl_handle(const XEvent& thisevent)
{
XEvent xevent = thisevent;
@@ -1359,6 +1380,9 @@
case ReparentNotify: {
int xpos, ypos;
Window junk;
+
+ // on some systems, the ReparentNotify event is not handled as we would
expect.
+ XErrorHandler oldHandler = XSetErrorHandler(catchXExceptions());
//ReparentNotify gives the new position of the window relative to
//the new parent. FLTK cares about the position on the root window.
@@ -1366,10 +1390,13 @@
XRootWindow(fl_display, fl_screen),
xevent.xreparent.x, xevent.xreparent.y,
&xpos, &ypos, &junk);
+ XSetErrorHandler(oldHandler);
// tell Fl_Window about it and set flag to prevent echoing:
- resize_bug_fix = window;
- window->position(xpos, ypos);
+ if ( !wasXExceptionRaised() ) {
+ resize_bug_fix = window;
+ window->position(xpos, ypos);
+ }
break;
}
}
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit