summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_win32.cxx10
-rw-r--r--src/Fl_x.cxx6
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