Blame SOURCES/fltk-1_v2.3.0-modal.patch

ceac5b
diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm
ceac5b
--- fltk-1.3.0r9619.org/src/Fl_cocoa.mm	2012-06-19 12:54:43.694231638 +0200
ceac5b
+++ fltk-1.3.0r9619/src/Fl_cocoa.mm	2012-06-19 12:57:05.899048602 +0200
ceac5b
@@ -697,12 +697,9 @@
ceac5b
     return NO;	// prevent the caption to be redrawn as active on click
ceac5b
 		//  when another modal window is currently the key win
ceac5b
 
ceac5b
-  return !(w->tooltip_window() || w->menu_window());
ceac5b
+  return !w->tooltip_window();
ceac5b
 }
ceac5b
 
ceac5b
-// TODO see if we really need a canBecomeMainWindow ...
ceac5b
-#if 0
ceac5b
-
ceac5b
 - (BOOL)canBecomeMainWindow
ceac5b
 {
ceac5b
   if (Fl::modal_ && (Fl::modal_ != w))
ceac5b
@@ -711,7 +708,6 @@
ceac5b
 
ceac5b
   return !(w->tooltip_window() || w->menu_window());
ceac5b
 }
ceac5b
-#endif
ceac5b
 
ceac5b
 @end
ceac5b
 
ceac5b
diff -bur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx
ceac5b
--- fltk-1.3.0r9619.org/src/Fl_win32.cxx	2012-06-19 12:54:43.696231735 +0200
ceac5b
+++ fltk-1.3.0r9619/src/Fl_win32.cxx	2012-06-19 12:54:43.803236862 +0200
ceac5b
@@ -1065,6 +1065,10 @@
ceac5b
     break;
ceac5b
 
ceac5b
   case WM_SETFOCUS:
ceac5b
+    if ((Fl::modal_) && (Fl::modal_ != window)) {
ceac5b
+      SetFocus(fl_xid(Fl::modal_));
ceac5b
+      return 0;
ceac5b
+    }
ceac5b
     Fl::handle(FL_FOCUS, window);
ceac5b
     break;
ceac5b
 
ceac5b
@@ -1826,6 +1830,11 @@
ceac5b
     Fl::e_number = old_event;
ceac5b
     w->redraw(); // force draw to happen
ceac5b
   }
ceac5b
+
ceac5b
+  // Needs to be done before ShowWindow() to get the correct behaviour
ceac5b
+  // when we get WM_SETFOCUS.
ceac5b
+  if (w->modal()) {Fl::modal_ = w; fl_fix_focus();}
ceac5b
+
ceac5b
   // If we've captured the mouse, we dont want to activate any
ceac5b
   // other windows from the code, or we lose the capture.
ceac5b
   ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE :
ceac5b
@@ -1843,7 +1852,6 @@
ceac5b
     }
ceac5b
   }
ceac5b
 
ceac5b
-  if (w->modal()) {Fl::modal_ = w; fl_fix_focus();}
ceac5b
   return x;
ceac5b
 }
ceac5b
 
ceac5b
diff -bur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
ceac5b
--- fltk-1.3.0r9619.org/src/Fl_x.cxx	2012-06-19 12:54:43.697231783 +0200
ceac5b
+++ fltk-1.3.0r9619/src/Fl_x.cxx	2012-06-19 12:54:43.804236911 +0200
ceac5b
@@ -2101,6 +2101,12 @@
ceac5b
       while (wp->parent()) wp = wp->window();
ceac5b
       XSetTransientForHint(fl_display, xp->xid, fl_xid(wp));
ceac5b
       if (!wp->visible()) showit = 0; // guess that wm will not show it
ceac5b
+      if (win->modal()) {
ceac5b
+        Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0);
ceac5b
+        Atom net_wm_state_skip_taskbar = XInternAtom (fl_display, "_NET_WM_STATE_MODAL", 0);
ceac5b
+        XChangeProperty (fl_display, xp->xid, net_wm_state, XA_ATOM, 32,
ceac5b
+            PropModeAppend, (unsigned char*) &net_wm_state_skip_taskbar, 1);
ceac5b
+      }
ceac5b
     }
ceac5b
 
ceac5b
     // Make sure that borderless windows do not show in the task bar