mate-desktop / mate-applets

Applets for use with the MATE panel
http://www.mate-desktop.org
GNU General Public License v2.0
79 stars 67 forks source link

System Monitor: no tooltips with updates faster than 500ms #642

Closed fornellas closed 1 year ago

fornellas commented 1 year ago

Expected behaviour

With update interval set to 500ms:

image

when we hover the mouse over, we can see tooltips:

Screenshot at 2022-09-10 14-59-10

With update interval below 500ms (eg: 490), no tooltip is shown.

Actual behaviour

No tooltip is shown for update interval below 500ms.

Steps to reproduce the behaviour

My wild guess here is that the tool tip delay is 500ms, and updating the applet faster, disturbs the tool tip trigger, so it never happens.

MATE general version

1.26.0

Package version

mate-applets-1.26.0-0ubuntu1~focal2.0

Linux Distribution

Linux Mint 20.3 Una

zhuyaliang commented 1 year ago

Your guess is correct. Tooltip will no longer work when the time is less than 500 milliseconds.This is my test example:

static int count;

static gboolean
update_button_tooltip (GtkWidget *button)
{
    char *tooltip_text;

    tooltip_text = g_strdup_printf ("This is the %dth test", count),
    gtk_widget_set_tooltip_text (button, tooltip_text);

    g_free (tooltip_text);
    count ++;

    return TRUE;
}

int main (int argc,char *argv[])
{
    GtkWidget *window;
    GtkWidget *box;
    GtkWidget *button;

    gtk_init (&argc,&argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size (GTK_WINDOW (window), 350, 220);
    g_signal_connect ((window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);

    box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
    gtk_container_add (GTK_CONTAINER (window), box);

    button = gtk_button_new_with_label ("test");
    gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 6);

    g_timeout_add (500, (GSourceFunc) update_button_tooltip, button);

So this is a problem with GTK