summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2022-10-11 18:22:01 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2022-11-28 19:31:37 +0200
commit58fe70175b096b94d462e59e86ca721abc2b6c5f (patch)
tree418f229fa53ae7f88f0ae05dda00f20953e35c9e
parent8fb1dea42cdcc03f0accaa2ccdf55d170e542323 (diff)
downloadlibwnck-58fe70175b096b94d462e59e86ca721abc2b6c5f.tar.gz
tasklist: avoid useless tooltips
Do not show tooltip if text does not differ from button text and is already fully visible / not ellipsized. https://gitlab.gnome.org/GNOME/libwnck/-/issues/115
-rw-r--r--libwnck/tasklist.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
index f5b5299..ccc7427 100644
--- a/libwnck/tasklist.c
+++ b/libwnck/tasklist.c
@@ -590,12 +590,32 @@ wnck_button_query_tooltip (GtkWidget *widget,
GtkTooltip *tooltip)
{
WnckButton *self;
+ GtkLabel *label;
+ char *tooltip_text;
self = WNCK_BUTTON (widget);
if (!self->tasklist->priv->tooltips_enabled)
return FALSE;
+ label = GTK_LABEL (self->label);
+ tooltip_text = gtk_widget_get_tooltip_text (widget);
+
+ if (g_strcmp0 (gtk_label_get_text (label), tooltip_text) == 0)
+ {
+ PangoLayout *layout;
+
+ layout = gtk_label_get_layout (label);
+
+ if (!pango_layout_is_ellipsized (layout))
+ {
+ g_free (tooltip_text);
+ return FALSE;
+ }
+ }
+
+ g_free (tooltip_text);
+
return GTK_WIDGET_CLASS (wnck_button_parent_class)->query_tooltip (widget,
x,
y,