diff options
| author | Greg Ercolano <erco@seriss.com> | 2015-01-11 04:21:08 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2015-01-11 04:21:08 +0000 |
| commit | 25aa484f5ea361ddeb74c901cf0abc76602449de (patch) | |
| tree | d6265f04a69f0e22b07f2fdb3c149c1f53072e38 | |
| parent | c732a4d635e8b6fe2765bb18bb8e8ef19cbaf2f2 (diff) | |
Prevent tooltips from opening if window recently iconized.
Fixes STR #3157.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10514 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_Tooltip.cxx | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx index 66e782b77..159d2929a 100644 --- a/src/Fl_Tooltip.cxx +++ b/src/Fl_Tooltip.cxx @@ -131,6 +131,15 @@ static void recent_timeout(void*) { static char recursion; +// Is top level window iconified? +static int top_win_iconified_() { + Fl_Widget *w = Fl_Tooltip::current(); + if ( !w ) return 0; + Fl_Window *topwin = w->top_window(); + if ( !topwin ) return 0; + return !topwin->visible() ? 1 : 0; +} + static void tooltip_timeout(void*) { #ifdef DEBUG puts("tooltip_timeout();"); @@ -138,22 +147,24 @@ static void tooltip_timeout(void*) { if (recursion) return; recursion = 1; - if (!tip || !*tip) { - if (window) window->hide(); - } else { - int condition = 1; + if (!top_win_iconified_()) { // no tooltip if top win iconified (STR #3157) + if (!tip || !*tip) { + if (window) window->hide(); + } else { + int condition = 1; #if !(defined(__APPLE__) || defined(WIN32)) - condition = (Fl::grab() == NULL); + condition = (Fl::grab() == NULL); #endif - if ( condition ) { - if (!window) window = new Fl_TooltipBox; - // this cast bypasses the normal Fl_Window label() code: - ((Fl_Widget*)window)->label(tip); - window->layout(); - window->redraw(); - // printf("tooltip_timeout: Showing window %p with tooltip \"%s\"...\n", - // window, tip ? tip : "(null)"); - window->show(); + if ( condition ) { + if (!window) window = new Fl_TooltipBox; + // this cast bypasses the normal Fl_Window label() code: + ((Fl_Widget*)window)->label(tip); + window->layout(); + window->redraw(); + // printf("tooltip_timeout: Showing window %p with tooltip \"%s\"...\n", + // window, tip ? tip : "(null)"); + window->show(); + } } } |
