diff options
author | Błażej Szczygieł <[email protected]> | 2016-03-28 21:00:08 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-10-21 10:59:54 +0200 |
commit | 6bbbccfde430a26b4d288a97117c87c622986f69 (patch) | |
tree | 5bd826ab0670aaa922fd603353d3e984cccec310 /sensors-applet/active-sensor.c | |
parent | b2d548ff701f0caa142dbf964dd2258fc10ea3ff (diff) | |
download | mate-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/active-sensor.c')
-rw-r--r-- | sensors-applet/active-sensor.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/sensors-applet/active-sensor.c b/sensors-applet/active-sensor.c index 5a5782c..f542055 100644 --- a/sensors-applet/active-sensor.c +++ b/sensors-applet/active-sensor.c @@ -646,7 +646,8 @@ void active_sensor_update(ActiveSensor *active_sensor, } /* end else on error */ /* setup for tooltips */ - tooltip = g_strdup_printf("%s %s", sensor_label, value_tooltip); + if (sensors_applet->show_tooltip) + tooltip = g_strdup_printf("%s %s", sensor_label, value_tooltip); g_free(value_tooltip); /* only do icons and labels / graphs if needed */ @@ -667,10 +668,11 @@ void active_sensor_update(ActiveSensor *active_sensor, active_sensor->sensor_low_value = sensor_low_value; active_sensor->sensor_high_value = sensor_high_value; active_sensor_update_icon(active_sensor, icon_pixbuf, sensor_type); - } - /* always update tooltip */ - gtk_widget_set_tooltip_text(active_sensor->icon, - tooltip); + } + if (tooltip) { + gtk_widget_set_tooltip_text(active_sensor->icon, + tooltip); + } } active_sensor_update_sensor_value(active_sensor, sensor_value); @@ -684,8 +686,10 @@ void active_sensor_update(ActiveSensor *active_sensor, &(active_sensor->graph_color)); gtk_widget_queue_draw (active_sensor->graph); - gtk_widget_set_tooltip_text(active_sensor->graph, - tooltip); + if (tooltip) { + gtk_widget_set_tooltip_text(active_sensor->graph, + tooltip); + } } @@ -733,10 +737,10 @@ void active_sensor_update(ActiveSensor *active_sensor, } gtk_label_set_markup(GTK_LABEL(active_sensor->value), value_text); - - - gtk_widget_set_tooltip_text(active_sensor->value, - tooltip); + if (tooltip) { + gtk_widget_set_tooltip_text(active_sensor->value, + tooltip); + } } /* finished with value text */ g_free(value_text); @@ -750,8 +754,10 @@ void active_sensor_update(ActiveSensor *active_sensor, } gtk_label_set_markup(GTK_LABEL(active_sensor->label), sensor_label); - gtk_widget_set_tooltip_text(active_sensor->label, - tooltip); + if (tooltip) { + gtk_widget_set_tooltip_text(active_sensor->label, + tooltip); + } } |