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
This commit is contained in:
Pierre Ossman 2014-06-11 14:09:28 +00:00
parent 0cfc2554c6
commit 7057e56c28
2 changed files with 15 additions and 1 deletions

View File

@ -1099,6 +1099,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
break; break;
case WM_SETFOCUS: case WM_SETFOCUS:
if ((Fl::modal_) && (Fl::modal_ != window)) {
SetFocus(fl_xid(Fl::modal_));
return 0;
}
Fl::handle(FL_FOCUS, window); Fl::handle(FL_FOCUS, window);
break; break;
@ -1845,6 +1849,11 @@ Fl_X* Fl_X::make(Fl_Window* w) {
Fl::e_number = old_event; Fl::e_number = old_event;
w->redraw(); // force draw to happen 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 // If we've captured the mouse, we dont want to activate any
// other windows from the code, or we lose the capture. // other windows from the code, or we lose the capture.
ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE : 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; return x;
} }

View File

@ -2432,6 +2432,12 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
while (wp->parent()) wp = wp->window(); while (wp->parent()) wp = wp->window();
XSetTransientForHint(fl_display, xp->xid, fl_xid(wp)); XSetTransientForHint(fl_display, xp->xid, fl_xid(wp));
if (!wp->visible()) showit = 0; // guess that wm will not show it 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 // Make sure that borderless windows do not show in the task bar