[libwnck/wip/muktupavels/tasklist-tooltips] tasklist: avoid useless tooltips
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libwnck/wip/muktupavels/tasklist-tooltips] tasklist: avoid useless tooltips
- Date: Tue, 11 Oct 2022 15:27:19 +0000 (UTC)
commit c55f49e18710e5d26cf5cc7301b140d1dc73b7c0
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Oct 11 18:22:01 2022 +0300
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
libwnck/tasklist.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
index 606094c4..33ac2905 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]