summaryrefslogtreecommitdiff
path: root/applets/clock
diff options
context:
space:
mode:
authorBłażej Szczygieł <[email protected]>2016-03-28 18:20:19 +0200
committerraveit65 <[email protected]>2016-10-21 09:53:38 +0200
commitbf573b447308e30193c333e71dee20f8d3134418 (patch)
tree3a2b8d71a30b587143e881760352aedd25245bd7 /applets/clock
parent25dfb51de867b4c271a8ae8f9f07f30e4b0c857b (diff)
downloadmate-panel-bf573b447308e30193c333e71dee20f8d3134418.tar.bz2
mate-panel-bf573b447308e30193c333e71dee20f8d3134418.tar.xz
clock: update tooltip only when new text is different
This can prevent problems with OpenGL on some drivers (see #397)
Diffstat (limited to 'applets/clock')
-rw-r--r--applets/clock/clock.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 6bb0890b..17aeb172 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -674,6 +674,8 @@ update_clock (ClockData * cd)
static void
update_tooltip (ClockData * cd)
{
+ char *tip;
+ char *old_tip;
if (!cd->showdate) {
struct tm *tm;
char date[256];
@@ -681,7 +683,6 @@ update_tooltip (ClockData * cd)
char *zone;
time_t now_t;
struct tm now;
- char *tip;
tm = localtime (&cd->current_time);
@@ -714,17 +715,23 @@ update_tooltip (ClockData * cd)
tip = g_strdup_printf (utf8, zone);
- gtk_widget_set_tooltip_text (cd->panel_button, tip);
g_free (utf8);
- g_free (tip);
} else {
- if (cd->calendar_popup)
- gtk_widget_set_tooltip_text (cd->panel_button,
- _("Click to hide month calendar"));
- else
- gtk_widget_set_tooltip_text (cd->panel_button,
- _("Click to view month calendar"));
+ if (cd->calendar_popup)
+ tip = _("Click to hide month calendar");
+ else
+ tip = _("Click to view month calendar");
}
+
+ /* Update only when the new tip is different.
+ * This can prevent problems with OpenGL on some drivers */
+ old_tip = gtk_widget_get_tooltip_text (cd->panel_button);
+ if (g_strcmp0 (old_tip, tip))
+ gtk_widget_set_tooltip_text (cd->panel_button, tip);
+
+ g_free (old_tip);
+ if (!cd->showdate)
+ g_free (tip);
}
static void