diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm --- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-19 12:54:43.694231638 +0200 +++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-19 12:57:05.899048602 +0200 @@ -697,12 +697,9 @@ return NO; // prevent the caption to be redrawn as active on click // when another modal window is currently the key win - return !(w->tooltip_window() || w->menu_window()); + return !w->tooltip_window(); } -// TODO see if we really need a canBecomeMainWindow ... -#if 0 - - (BOOL)canBecomeMainWindow { if (Fl::modal_ && (Fl::modal_ != w)) @@ -711,7 +708,6 @@ return !(w->tooltip_window() || w->menu_window()); } -#endif @end diff -bur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx --- fltk-1.3.0r9619.org/src/Fl_win32.cxx 2012-06-19 12:54:43.696231735 +0200 +++ fltk-1.3.0r9619/src/Fl_win32.cxx 2012-06-19 12:54:43.803236862 +0200 @@ -1065,6 +1065,10 @@ break; case WM_SETFOCUS: + if ((Fl::modal_) && (Fl::modal_ != window)) { + SetFocus(fl_xid(Fl::modal_)); + return 0; + } Fl::handle(FL_FOCUS, window); break; @@ -1826,6 +1830,11 @@ 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 : @@ -1843,7 +1852,6 @@ } } - if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} return x; } diff -bur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx --- fltk-1.3.0r9619.org/src/Fl_x.cxx 2012-06-19 12:54:43.697231783 +0200 +++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-19 12:54:43.804236911 +0200 @@ -2101,6 +2101,12 @@ 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