diff options
| author | Pierre Ossman <ossman@cendio.se> | 2014-06-11 14:09:28 +0000 |
|---|---|---|
| committer | Pierre Ossman <ossman@cendio.se> | 2014-06-11 14:09:28 +0000 |
| commit | 7057e56c28f7c08d45521fbc29efaf5a4913bf1a (patch) | |
| tree | 534f95f790f770189f13d4b7bc296926cfdd8e0b | |
| parent | 0cfc2554c695bd472ce9e579ddcf1240f4fa155a (diff) | |
Behave better when it comes to modal windows. Primarily this
makes sure that windows are decorated better when a modal window
is active. STR #2802.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10190 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_win32.cxx | 10 | ||||
| -rw-r--r-- | src/Fl_x.cxx | 6 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index fceae16f1..8ca3a70ec 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1099,6 +1099,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar break; case WM_SETFOCUS: + if ((Fl::modal_) && (Fl::modal_ != window)) { + SetFocus(fl_xid(Fl::modal_)); + return 0; + } Fl::handle(FL_FOCUS, window); break; @@ -1845,6 +1849,11 @@ Fl_X* Fl_X::make(Fl_Window* w) { Fl::e_number = old_event; w->redraw(); // force draw to happen } + + // Needs to be done before ShowWindow() to get the correct behaviour + // when we get WM_SETFOCUS. + if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} + // If we've captured the mouse, we dont want to activate any // other windows from the code, or we lose the capture. ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE : @@ -1862,7 +1871,6 @@ Fl_X* Fl_X::make(Fl_Window* w) { } } - if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} return x; } diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index bc5810b7c..3896777cd 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -2432,6 +2432,12 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap) while (wp->parent()) wp = wp->window(); XSetTransientForHint(fl_display, xp->xid, fl_xid(wp)); if (!wp->visible()) showit = 0; // guess that wm will not show it + if (win->modal()) { + Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0); + Atom net_wm_state_skip_taskbar = XInternAtom (fl_display, "_NET_WM_STATE_MODAL", 0); + XChangeProperty (fl_display, xp->xid, net_wm_state, XA_ATOM, 32, + PropModeAppend, (unsigned char*) &net_wm_state_skip_taskbar, 1); + } } // Make sure that borderless windows do not show in the task bar |
