DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2627
Version: 1.4-feature


The editor demo filled with a modified text (just type a few keys),
coupled with the external window-closing program, provides a 
simple test bed for this issue.

Test operations:
- run editor
- type in a few key strokes
- close the editor window with the external window-closing program
- click "cancel" in the FLTK dialog that appears


With the proposed patch:
  case DestroyNotify:
      event = FL_CLOSE;
      break;
the test fails : the program remains hung with no window left.

The solution I propose is this:
  case DestroyNotify:
    {
      Fl::handle(FL_CLOSE, window);
      Fl_X* loop = Fl_X::first;
      while(loop && loop->w != window) loop = loop->next;
      if (loop) {
        window->hide();
        window->show();
        }
      return 1;
    }

If the DestroyNotify X11 event arrives, it means a window has been
externally closed. We try to close it the FLTK proper way
(Fl::handle(FL_CLOSE, window);). We check whether it has been closed
in the FLTK sense (its window no longer exists in FLTK's window list).
If not, we recreate the window by window->show().

This way, FLTK and X11 have the same list of opened windows.
We still have a
X_DestroyWindow: BadWindow (invalid Window parameter) 0x600006
error message sent to stderr.
This can be solved by arranging for Fl_Window::hide() not to call 
XDestroyWindow for a window that previously triggered DestroyNotify.


Link: http://www.fltk.org/str.php?L2627
Version: 1.4-feature

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to