Skip to content

Commit

Permalink
Prevent tooltips from opening if window recently iconized.
Browse files Browse the repository at this point in the history
Fixes STR #3157.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10514 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
erco77 committed Jan 11, 2015
1 parent c732a4d commit 25aa484
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions src/Fl_Tooltip.cxx
Expand Up @@ -131,29 +131,40 @@ 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();");
#endif // DEBUG

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();
}
}
}

Expand Down

0 comments on commit 25aa484

Please sign in to comment.