diff options
| author | Lauri Kasanen <cand@gmx.com> | 2014-11-27 09:47:40 +0000 |
|---|---|---|
| committer | Lauri Kasanen <cand@gmx.com> | 2014-11-27 09:47:40 +0000 |
| commit | e7e8faa25b55e36c8cc085f8737082f3319dcae5 (patch) | |
| tree | 02ef407c59bd4cf1d9143268e2357866168d59c1 /src/Fl_Tooltip.cxx | |
| parent | a48249523663dc0bc3a2d249a5e51166841d7b2c (diff) | |
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
Diffstat (limited to 'src/Fl_Tooltip.cxx')
| -rw-r--r-- | src/Fl_Tooltip.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx index a3deaaa6a..66e782b77 100644 --- a/src/Fl_Tooltip.cxx +++ b/src/Fl_Tooltip.cxx @@ -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 (;;) { |
