summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Window.H45
-rw-r--r--src/Fl_Menu.cxx2
-rw-r--r--src/Fl_Tooltip.cxx1
3 files changed, 46 insertions, 2 deletions
diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H
index bb4858c66..0f7fd9610 100644
--- a/FL/Fl_Window.H
+++ b/FL/Fl_Window.H
@@ -75,7 +75,9 @@ class FL_EXPORT Fl_Window : public Fl_Group {
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 @@ public:
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 @@ public:
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
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx
index 1eba33867..91c5086ef 100644
--- a/src/Fl_Menu.cxx
+++ b/src/Fl_Menu.cxx
@@ -268,6 +268,7 @@ menutitle::menutitle(int X, int Y, int W, int H, const Fl_Menu_Item* L) :
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 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
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;
diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx
index 6c6ab4226..0ca2178de 100644
--- a/src/Fl_Tooltip.cxx
+++ b/src/Fl_Tooltip.cxx
@@ -52,6 +52,7 @@ public:
/** Creates the box window */
Fl_TooltipBox() : Fl_Menu_Window(0, 0) {
set_override();
+ set_tooltip_window();
end();
}
void draw();