all repos — tint2 @ cf748d6d41ffb375014c203a704dd0e7710697e4

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Revert "Remove static clock tooltip buffer" (g_date_time_format uses format strings slightly different from strftime)

This reverts commit 441c42077323c084542698367e73645fa11d76f4.
o9000 o9000
commit

cf748d6d41ffb375014c203a704dd0e7710697e4

parent

8528a6a4a4d3b6d12243f0e631dce39d772ca0a1

1 files changed, 4 insertions(+), 7 deletions(-)

jump to
M src/clock/clock.csrc/clock/clock.c

@@ -48,6 +48,7 @@ PangoFontDescription *time1_font_desc;

PangoFontDescription *time2_font_desc; static char buf_time[256]; static char buf_date[256]; +static char buf_tooltip[512]; int clock_enabled; static timeout* clock_timeout;

@@ -145,13 +146,8 @@ }

char* clock_get_tooltip(void* obj) { - GTimeZone *tz = g_time_zone_new(time_tooltip_timezone); - GDateTime *now = g_date_time_new_now(tz); - char *result = g_date_time_format(now, time_tooltip_format); - g_date_time_unref(now); - g_time_zone_unref(tz); - - return result; + strftime(buf_tooltip, sizeof(buf_tooltip), time_tooltip_format, clock_gettime_for_tz(time_tooltip_timezone)); + return strdup(buf_tooltip); } int time_format_needs_sec_ticks(char *time_format)

@@ -201,6 +197,7 @@ clock->area.on_screen = 1;

if (time_tooltip_format) { clock->area._get_tooltip_text = clock_get_tooltip; + strftime(buf_tooltip, sizeof(buf_tooltip), time_tooltip_format, clock_gettime_for_tz(time_tooltip_timezone)); } }