summaryrefslogtreecommitdiff
path: root/sensors-applet/sensors-applet.c
diff options
context:
space:
mode:
authorBłażej Szczygieł <[email protected]>2016-03-28 21:00:08 +0200
committerraveit65 <[email protected]>2016-10-21 10:59:54 +0200
commit6bbbccfde430a26b4d288a97117c87c622986f69 (patch)
tree5bd826ab0670aaa922fd603353d3e984cccec310 /sensors-applet/sensors-applet.c
parentb2d548ff701f0caa142dbf964dd2258fc10ea3ff (diff)
downloadmate-sensors-applet-6bbbccfde430a26b4d288a97117c87c622986f69.tar.bz2
mate-sensors-applet-6bbbccfde430a26b4d288a97117c87c622986f69.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.c26
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);