summaryrefslogtreecommitdiff
path: root/src/Fl.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-03-23 07:08:17 +0000
committerManolo Gouy <Manolo>2016-03-23 07:08:17 +0000
commit270b437500552cba0d082363f9124456f16a1fda (patch)
treeac7245b95a138a5f64c6e6b8318632fd4dc45075 /src/Fl.cxx
parentbf7e4de688fc1f0e3008049a41c07543a7da0752 (diff)
Rewrite Fl_Window::hide() under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11402 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl.cxx')
-rw-r--r--src/Fl.cxx141
1 files changed, 0 insertions, 141 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 5e725cfcc..11d0c62ce 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1450,147 +1450,6 @@ int Fl::handle_(int e, Fl_Window* window)
return send_handlers(e);
}
-////////////////////////////////////////////////////////////////
-// hide() destroys the X window, it does not do unmap!
-
-#if defined(WIN32)
-extern void fl_clipboard_notify_retarget(HWND wnd);
-extern void fl_update_clipboard(void);
-#elif USE_XFT
-extern void fl_destroy_xft_draw(Window);
-#endif
-
-void Fl_Window::hide() {
-#ifdef WIN32 // platform fix
- // STR#3079: if there remains a window and a non-modal window, and the window is deleted,
- // the app remains running without any apparent window.
- // Bug mechanism: hiding an owner window unmaps the owned (non-modal) window(s)
- // but does not delete it(them) in FLTK.
- // Fix for it:
- // when hiding a window, build list of windows it owns, and do hide/show on them.
- int count = 0;
- Fl_Window *win, **doit = NULL;
- for (win = Fl::first_window(); win && i; win = Fl::next_window(win)) {
- if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == i->xid) {
- count++;
- }
- }
- if (count) {
- doit = new Fl_Window*[count];
- count = 0;
- for (win = Fl::first_window(); win && i; win = Fl::next_window(win)) {
- if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == i->xid) {
- doit[count++] = win;
- }
- }
- }
-#endif
- clear_visible();
-
- if (!shown()) return;
-
- // remove from the list of windows:
- Fl_X* ip = i;
- Fl_X** pp = &Fl_X::first;
- for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return;
- *pp = ip->next;
-#ifdef __APPLE__ // platform fix
- // MacOS X manages a single pointer per application. Make sure that hiding
- // a toplevel window will not leave us with some random pointer shape, or
- // worst case, an invisible pointer
- if (!parent()) cursor(FL_CURSOR_DEFAULT);
-#endif
- i = 0;
-
- // recursively remove any subwindows:
- for (Fl_X *wi = Fl_X::first; wi;) {
- Fl_Window* W = wi->w;
- if (W->window() == this) {
- W->hide();
- W->set_visible();
- wi = Fl_X::first;
- } else wi = wi->next;
- }
-
- if (this == Fl::modal_) { // we are closing the modal window, find next one:
- Fl_Window* W;
- for (W = Fl::first_window(); W; W = Fl::next_window(W))
- if (W->modal()) break;
- Fl::modal_ = W;
- }
-
- // Make sure no events are sent to this window:
- fl_throw_focus(this);
- handle(FL_HIDE);
-
-#if defined(WIN32)
- // make sure any custom icons get freed
- icons(NULL, 0);
- // this little trick keeps the current clipboard alive, even if we are about
- // to destroy the window that owns the selection.
- if (GetClipboardOwner()==ip->xid)
- fl_update_clipboard();
- // Make sure we unlink this window from the clipboard chain
- fl_clipboard_notify_retarget(ip->xid);
- // Send a message to myself so that I'll get out of the event loop...
- PostMessage(ip->xid, WM_APP, 0, 0);
- if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc);
- if (ip->xid == fl_window && fl_graphics_driver->gc()) {
- fl_release_dc(fl_window, (HDC)fl_graphics_driver->gc());
- fl_window = (HWND)-1;
- fl_graphics_driver->gc(0);
-# ifdef FLTK_USE_CAIRO
- if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0);
-# endif
- }
-#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform window unmapping
- Fl_X::q_release_context(ip);
- if ( ip->xid == fl_window )
- fl_window = 0;
-#endif
-
- if (ip->region) XDestroyRegion(ip->region);
-
-#if defined(USE_X11)
-# if USE_XFT
- fl_destroy_xft_draw(ip->xid);
-# endif
- // 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();
- if (p==GetParent(ip->xid)) {
- ShowWindow(ip->xid, SW_HIDE);
- ShowWindow(p, SW_SHOWNA);
- }
- XDestroyWindow(fl_display, ip->xid);
- // end of fix for STR#3079
- if (count) {
- int ii;
- for (ii = 0; ii < count; ii++) doit[ii]->hide();
- for (ii = 0; ii < count; ii++) {
- if (ii != 0) doit[0]->show(); // Fix for STR#3165
- doit[ii]->show();
- }
- delete[] doit;
- }
-#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform window unmapping
- ip->destroy();
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: code to destroy a window on screen"
-#else
-# error unsupported platform
-#endif
-
-#ifdef WIN32
- // Try to stop the annoying "raise another program" behavior
- if (non_modal() && Fl::first_window() && Fl::first_window()->shown())
- Fl::first_window()->show();
-#endif
- delete ip;
-}
-
// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
// or any parent changes. We must correctly map/unmap the system's window.