From 25aa484f5ea361ddeb74c901cf0abc76602449de Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Sun, 11 Jan 2015 04:21:08 +0000 Subject: 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 --- src/Fl_Tooltip.cxx | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'src') 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(); + } } } -- cgit v1.2.3