Author: AlbrechtS
Date: 2009-08-02 23:26:32 -0700 (Sun, 02 Aug 2009)
New Revision: 6841
Log:
Added new Fl_Window:: flags() and methods:

 - set_menu_window() to mark a window as a menu window
 - set_tooltip_window() to mark a window as a tooltip window

and the corresponding get methods:

 - menu_window()
 - tooltip_window().

This is a first step for providing more information for correct parenting
and properties to support modern (X) window managers (STR #2230).

Please see also the information in fltk.development:

http://www.fltk.org/newsgroups.php?gfltk.development+v:8003

ToDo: Another point is to be able to handle menu windows and popup windows
that are opened while a menu is active properly (will follow later).


Modified:
   branches/branch-1.3/FL/Fl_Window.H
   branches/branch-1.3/src/Fl_Menu.cxx
   branches/branch-1.3/src/Fl_Tooltip.cxx

Modified: branches/branch-1.3/FL/Fl_Window.H
===================================================================
--- branches/branch-1.3/FL/Fl_Window.H  2009-08-02 10:25:08 UTC (rev 6840)
+++ branches/branch-1.3/FL/Fl_Window.H  2009-08-03 06:26:32 UTC (rev 6841)
@@ -75,7 +75,9 @@
     FL_NOBORDER = 8,
     FL_FORCE_POSITION = 16,
     FL_NON_MODAL = 32,
-    FL_OVERRIDE = 256
+    FL_OVERRIDE = 256,
+    FL_MENU_WINDOW = 4096,
+    FL_TOOLTIP_WINDOW = 8192
   };
   void _Fl_Window(); // constructor innards
 
@@ -177,7 +179,7 @@
     being delivered to other windows in the same program, and will also
     remain on top of the other windows (if the X window manager supports
     the "transient for" property).  Several modal windows may be shown at
-    once, in which case only the last one shown gets events.  You can See
+    once, in which case only the last one shown gets events.  You can see
     which window (if any) is modal by calling 
     Fl::modal().
   */
@@ -195,6 +197,45 @@
   int non_modal() const {return flags() & (FL_NON_MODAL|FL_MODAL);}
 
   /**
+    Marks the window as a menu window.
+    
+    This is intended for internal use, but it can also be used if you
+    write your own menu handling. However, this is not recommended.
+
+    This flag is used for correct "parenting" of windows in communication
+    with the windowing system. Modern X window managers can use different
+    flags to distinguish menu and tooltip windows from normal windows.
+    
+    This must be called before the window is shown and cannot be changed
+    later.
+  */
+  void set_menu_window()       {set_flag(FL_MENU_WINDOW);}
+
+  /**  Returns true if this window is a menu window. */
+  int menu_window() const {return flags() & FL_MENU_WINDOW;}
+
+  /**
+    Marks the window as a tooltip window.
+    
+    This is intended for internal use, but it can also be used if you
+    write your own tooltip handling. However, this is not recommended.
+
+    This flag is used for correct "parenting" of windows in communication
+    with the windowing system. Modern X window managers can use different
+    flags to distinguish menu and tooltip windows from normal windows.
+    
+    This must be called before the window is shown and cannot be changed
+    later.
+
+    \note Since Fl_Tooltip_Window is derived from Fl_Menu_Window, this
+    also \b clears the menu_window() state.
+  */
+  void set_tooltip_window()    { set_flag(FL_TOOLTIP_WINDOW);
+                                 clear_flag(FL_MENU_WINDOW); }
+  /**  Returns true if this window is a tooltip window. */
+  int tooltip_window() const {return flags() & FL_TOOLTIP_WINDOW;}
+
+  /**
     Position the window so that the mouse is pointing at the
     given position, or at the center of the given widget, which may be the
     window itself.  If the optional offscreen parameter is

Modified: branches/branch-1.3/src/Fl_Menu.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Menu.cxx 2009-08-02 10:25:08 UTC (rev 6840)
+++ branches/branch-1.3/src/Fl_Menu.cxx 2009-08-03 06:26:32 UTC (rev 6841)
@@ -268,6 +268,7 @@
   end();
   set_modal();
   clear_border();
+  set_menu_window();
   menu = L;
   if (L->labelcolor_ || Fl::scheme() || L->labeltype_ > FL_NO_LABEL) 
clear_overlay();
 }
@@ -286,6 +287,7 @@
   end();
   set_modal();
   clear_border();
+  set_menu_window();
   menu = m;
   if (m) m = m->first(); // find the first item that needs to be rendered
   drawn_selected = -1;

Modified: branches/branch-1.3/src/Fl_Tooltip.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Tooltip.cxx      2009-08-02 10:25:08 UTC (rev 
6840)
+++ branches/branch-1.3/src/Fl_Tooltip.cxx      2009-08-03 06:26:32 UTC (rev 
6841)
@@ -52,6 +52,7 @@
   /** Creates the box window */
   Fl_TooltipBox() : Fl_Menu_Window(0, 0) {
     set_override();
+    set_tooltip_window();
     end();
   }
   void draw();

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to