diff options
author | Błażej Szczygieł <[email protected]> | 2016-03-28 21:00:08 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-10-21 11:01:09 +0200 |
commit | 32332827e3895222507eb094840fbe451c1b7523 (patch) | |
tree | 5bd826ab0670aaa922fd603353d3e984cccec310 /sensors-applet/sensors-applet.c | |
parent | b2d548ff701f0caa142dbf964dd2258fc10ea3ff (diff) | |
download | mate-sensors-applet-32332827e3895222507eb094840fbe451c1b7523.tar.bz2 mate-sensors-applet-32332827e3895222507eb094840fbe451c1b7523.tar.xz |
Update tooltip only when mouse is over the applet
This can prevent problems with OpenGL on some drivers. The problem is
described here: https://github.com/mate-desktop/mate-panel/issues/397
This also updates all sensors when mouse enters the applet to get
updated values.
Diffstat (limited to 'sensors-applet/sensors-applet.c')
-rw-r--r-- | sensors-applet/sensors-applet.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sensors-applet/sensors-applet.c b/sensors-applet/sensors-applet.c index 5649fc1..b4f58cc 100644 --- a/sensors-applet/sensors-applet.c +++ b/sensors-applet/sensors-applet.c @@ -217,6 +217,25 @@ static void style_set_cb(GtkWidget *widget, } +static gboolean mouse_enter_cb(GtkWidget *widget, + GdkEventCrossing *event, + gpointer data) +{ + SensorsApplet *sensor_applet = data; + sensor_applet->show_tooltip = TRUE; + sensors_applet_update_active_sensors(sensor_applet); + return TRUE; +} + +static gboolean mouse_leave_cb(GtkWidget *widget, + GdkEventCrossing *event, + gpointer data) +{ + SensorsApplet *sensor_applet = data; + sensor_applet->show_tooltip = FALSE; + return TRUE; +} + static const GtkActionEntry sensors_applet_menu_actions[] = { { "Preferences", GTK_STOCK_PROPERTIES, N_("_Preferences"), NULL, NULL, @@ -1372,6 +1391,13 @@ void sensors_applet_init(SensorsApplet *sensors_applet) { G_CALLBACK(size_allocate_cb), sensors_applet); + g_signal_connect(G_OBJECT(sensors_applet->applet), "leave_notify_event", + G_CALLBACK(mouse_leave_cb), + (gpointer)sensors_applet); + + g_signal_connect(G_OBJECT(sensors_applet->applet), "enter_notify_event", + G_CALLBACK(mouse_enter_cb), + (gpointer)sensors_applet); sensors_applet_update_active_sensors(sensors_applet); |