Improve tooltip behavior for huge tooltips: remove flicker, support key/mouse dismiss

Fixes STR 2650.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10473 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Lauri Kasanen 2014-11-27 09:47:40 +00:00
parent a482495236
commit e7e8faa25b

View File

@ -57,6 +57,14 @@ public:
Fl_Menu_Window::show();
}
int handle(int e) {
if (e == FL_PUSH || e == FL_KEYDOWN) {
hide();
return 1;
}
return Fl_Menu_Window::handle(e);
}
};
Fl_Widget* Fl_Tooltip::widget_ = 0;
@ -168,7 +176,13 @@ void Fl_Tooltip::enter_(Fl_Widget* w) {
printf("Fl_Tooltip::enter_(w=%p)\n", w);
printf(" window=%p\n", window);
#endif // DEBUG
if (w && w->as_window() && ((Fl_Window*)w)->tooltip_window()) {
// Fix STR #2650: if there's no better place for a tooltip window, don't move it.
int oldx = w->x();
int oldy = w->y();
((Fl_TooltipBox*)w)->layout();
if (w->x() == oldx && w->y() == oldy) return;
}
// find the enclosing group with a tooltip:
Fl_Widget* tw = w;
for (;;) {