Author: manolo
Date: 2011-05-23 09:49:02 -0700 (Mon, 23 May 2011)
New Revision: 8723
Log:
Fix STR #2627: if an X11 window is externally destroyed, FLTK now reacts
coherently
either deleting the corresponding FLTK window, or recreating the X11 window.
Modified:
branches/branch-1.3/src/Fl.cxx
branches/branch-1.3/src/Fl_x.cxx
Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx 2011-05-23 16:06:13 UTC (rev 8722)
+++ branches/branch-1.3/src/Fl.cxx 2011-05-23 16:49:02 UTC (rev 8723)
@@ -1439,7 +1439,8 @@
# if USE_XFT
fl_destroy_xft_draw(ip->xid);
# endif
- XDestroyWindow(fl_display, ip->xid);
+ // this test makes sure ip->xid has not been destroyed already
+ if (ip->xid) XDestroyWindow(fl_display, ip->xid);
#elif defined(WIN32)
// this little trickery seems to avoid the popup window stacking problem
HWND p = GetForegroundWindow();
Modified: branches/branch-1.3/src/Fl_x.cxx
===================================================================
--- branches/branch-1.3/src/Fl_x.cxx 2011-05-23 16:06:13 UTC (rev 8722)
+++ branches/branch-1.3/src/Fl_x.cxx 2011-05-23 16:49:02 UTC (rev 8723)
@@ -1070,6 +1070,19 @@
if (window) switch (xevent.type) {
+ case DestroyNotify: { // an X11 window was closed externally from the
program
+ Fl::handle(FL_CLOSE, window);
+ Fl_X* X = Fl_X::i(window);
+ if (X) { // indicates the FLTK window was not closed
+ X->xid = NULL; // indicates the X11 window was already destroyed
+ window->hide();
+ int oldx = window->x(), oldy = window->y();
+ window->position(0, 0);
+ window->position(oldx, oldy);
+ window->show(); // recreate the X11 window in support of the FLTK window
+ }
+ return 1;
+ }
case ClientMessage: {
Atom message = fl_xevent->xclient.message_type;
const long* data = fl_xevent->xclient.data.l;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit