changeset 1658:9793f025b43a

use belowmouse() as fltk::Widget for tooltips
author corvid <corvid@lavabit.com>
date Thu, 22 Apr 2010 02:18:59 +0000
parents 3c63fb1f08b3
children 0cf0c7e0064c
files dw/fltkplatform.cc dw/fltkplatform.hh
diffstat 2 files changed, 4 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkplatform.cc	Thu Apr 22 01:30:41 2010 +0000
+++ b/dw/fltkplatform.cc	Thu Apr 22 02:18:59 2010 +0000
@@ -152,13 +152,8 @@
    return color;
 }
 
-::fltk::Widget *FltkTooltip::widget = NULL;
-
 FltkTooltip::FltkTooltip (const char *text) : Tooltip(text)
 {
-   /* ::fltk::Tooltip really, really wants a Widget */
-   if (!widget)
-      widget = new ::fltk::InvisibleBox(1, 1, 0, 0, NULL);
    shown = false;
 
    if (!text || !strpbrk(text, "&@")) {
@@ -197,9 +192,10 @@
 
 void FltkTooltip::onEnter()
 {
-   Rectangle rect;
-   widget->get_absolute_rect(&rect);
-   ::fltk::Tooltip::enter(widget, rect, escaped_str ? escaped_str : str);
+   fltk::Widget *widget = fltk::belowmouse();
+
+   ::fltk::Tooltip::enter(widget, *((fltk::Rectangle *)widget),
+                          escaped_str ? escaped_str : str);
    shown = true;
 }
 
--- a/dw/fltkplatform.hh	Thu Apr 22 01:30:41 2010 +0000
+++ b/dw/fltkplatform.hh	Thu Apr 22 02:18:59 2010 +0000
@@ -50,7 +50,6 @@
    ~FltkTooltip ();
    bool shown;
    char *escaped_str; /* fltk WORKAROUND */
-   static ::fltk::Widget *widget;
 public:
    static FltkTooltip *create(const char *text);
    void onEnter();