Only update tooltips if there is an actual change -- #7268
authorRobin Gareus <robin@gareus.org>
Thu, 12 Apr 2018 00:34:19 +0000 (02:34 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 12 Apr 2018 00:54:55 +0000 (02:54 +0200)
Changing a tooltip resets the timeout. In one particular case,
while rolling, AudioClock::set() is calling set_tooltip() at a rate
faster than the tooltip timeout and prevents tooltip from showing at all
(even if there is no actual change to the tooltip text).
Alas, there is no trivial fix for this UI side and there may be other
such cases. A central check is more than practical.

libs/gtkmm2ext/gtk_ui.cc

index 0da843804583a468b058aae3c5ce969dff773e21..c321d94d4fe91493b33eb5a75ad8fd0291c21126 100644 (file)
@@ -483,7 +483,14 @@ UI::do_request (UIRequest* req)
 
        } else if (req->type == SetTip) {
 
-               gtk_widget_set_tooltip_markup (req->widget->gobj(), req->msg);
+               gchar* old = gtk_widget_get_tooltip_markup (req->widget->gobj());
+               if (
+                               (old && req->msg && strcmp (old, req->msg))
+                               ||
+                               ((old == NULL) != (req->msg == NULL || req->msg[0] == '\0'))
+                        ) {
+                       gtk_widget_set_tooltip_markup (req->widget->gobj(), req->msg);
+               }
 
        } else {