summaryrefslogtreecommitdiff
path: root/src/Fl_x.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-06-24 02:04:54 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-06-24 02:04:54 +0000
commitbb056f78056e107d3ca25cb2c0d6bc99835edcaa (patch)
tree9ae01fb6e95b02fc80b9f93d225f2fd874caaade /src/Fl_x.cxx
parent04f6fbbe037c519f91cb0035e17b04ff4b9b805f (diff)
Update GCC test in configure script.
Add range checking to BMP loader, and fix colormap + 4-bit BMP file loading. Copy 2.0 window position fix for XFree86 4.x and others. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2315 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_x.cxx')
-rw-r--r--src/Fl_x.cxx44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index cdb4f8c84..483802e27 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_x.cxx,v 1.24.2.24.2.21 2002/05/25 13:38:25 easysw Exp $"
+// "$Id: Fl_x.cxx,v 1.24.2.24.2.22 2002/06/24 02:04:54 easysw Exp $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
@@ -693,10 +693,6 @@ int fl_handle(const XEvent& xevent)
}
break;}
- case MapNotify:
- event = FL_SHOW;
- break;
-
case UnmapNotify:
event = FL_HIDE;
break;
@@ -858,21 +854,31 @@ int fl_handle(const XEvent& xevent)
fl_xmousewin = 0;
break;
+ // We cannot rely on the x,y position in the configure notify event.
+ // I now think this is an unavoidable problem with X: it is impossible
+ // for a window manager to prevent the "real" notify event from being
+ // sent when it resizes the contents, even though it can send an
+ // artificial event with the correct position afterwards (and some
+ // window managers do not send this fake event anyway)
+ // So anyway, do a round trip to find the correct x,y:
+ case MapNotify:
+ event = FL_SHOW;
+
case ConfigureNotify: {
- // We cannot rely on the x,y position in the configure notify event.
- // I now think this is an unavoidable problem with X: it is impossible
- // for a window manager to prevent the "real" notify event from being
- // sent when it resizes the contents, even though it can send an
- // artificial event with the correct position afterwards (and some
- // window managers do not send this fake event anyway)
- // So anyway, do a round trip to find the correct x,y:
- Window r, c; int X, Y, wX, wY; unsigned int m;
- XQueryPointer(fl_display, fl_xid(window), &r, &c, &X, &Y, &wX, &wY, &m);
- resize_bug_fix = window;
- window->resize(X-wX, Y-wY,
- xevent.xconfigure.width, xevent.xconfigure.height);
- return 1;}
+ if (window->parent()) break; // ignore child windows
+ // figure out where OS really put window
+ XWindowAttributes actual;
+ XGetWindowAttributes(fl_display, fl_xid(window), &actual);
+ Window cr; int X, Y, W = actual.width, H = actual.height;
+ XTranslateCoordinates(fl_display, fl_xid(window), actual.root,
+ 0, 0, &X, &Y, &cr);
+
+ // tell Fl_Window about it and set flag to prevent echoing:
+ resize_bug_fix = window;
+ window->resize(X, Y, W, H);
+ break; // allow add_handler to do something too
+ }
}
return Fl::handle(event, window);
@@ -1227,5 +1233,5 @@ void Fl_Window::make_current() {
#endif
//
-// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.21 2002/05/25 13:38:25 easysw Exp $".
+// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.22 2002/06/24 02:04:54 easysw Exp $".
//