From 706ec5c262dd8b99238d1db4871e6de071cf2624 Mon Sep 17 00:00:00 2001
From: Mark Tiefenbruck <mark@fluxbox.org>
Date: Tue, 7 Oct 2008 14:32:42 -0700
Subject: show/hide tooltip if title length changes enough while mouse is over
 the iconbutton

---
 src/IconButton.cc | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/IconButton.cc b/src/IconButton.cc
index b411a23..d63f6da 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -119,6 +119,8 @@ void IconButton::showTooltip() {
 
     if (FbTk::TextButton::textExceeds(xoffset))
         m_win.screen().showTooltip(m_win.title());
+    else
+        m_win.screen().hideTooltip();
 }
 
 void IconButton::clear() {
@@ -238,14 +240,11 @@ void IconButton::update(FbTk::Subject *subj) {
     } else {
         m_icon_window.clear();
     }
-    // if the title was changed AND the tooltip window is visible AND
-    // we have had an enter notify event ( without the leave notify )
-    // update the text inside it
-    if (subj == &m_win.titleSig() &&
-        m_has_tooltip &&
-        m_win.screen().tooltipWindow().isVisible()) {
-        m_win.screen().tooltipWindow().updateText(m_win.title());
-    }
+
+    // if the title was changed AND the mouse is over *this,
+    // update the tooltip
+    if (subj == &m_win.titleSig() && m_has_tooltip)
+        showTooltip();
 
 }
 
-- 
cgit v0.11.2