all repos — tint2 @ e5380f8e294db1ac5512dd87947f95d8cbaf3a7a

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

Timer: rename timeout -> timer
o9000 mrovi9000@gmail.com
commit

e5380f8e294db1ac5512dd87947f95d8cbaf3a7a

parent

c064ec70edc3f0477780cd0a32e091af1824d06f

M src/battery/battery.csrc/battery/battery.c

@@ -41,7 +41,7 @@ struct BatteryState battery_state;

gboolean battery_enabled; gboolean battery_tooltip_enabled; int percentage_hide; -static Timer battery_timeout; +static Timer battery_timer; #define BATTERY_BUF_SIZE 256 static char buf_bat_line1[BATTERY_BUF_SIZE];

@@ -76,7 +76,7 @@ battery_found = FALSE;

percentage_hide = 101; battery_low_cmd_sent = FALSE; battery_full_cmd_sent = FALSE; - INIT_TIMER(battery_timeout); + INIT_TIMER(battery_timer); bat1_has_font = FALSE; bat1_font_desc = NULL; bat1_format = NULL;

@@ -127,7 +127,7 @@ free(ac_connected_cmd);

ac_connected_cmd = NULL; free(ac_disconnected_cmd); ac_disconnected_cmd = NULL; - destroy_timer(&battery_timeout); + destroy_timer(&battery_timer); battery_found = FALSE; battery_os_free();

@@ -225,7 +225,7 @@ return;

battery_found = battery_os_init(); - change_timer(&battery_timeout, true, 10, 30000, update_battery_tick, 0); + change_timer(&battery_timer, true, 10, 30000, update_battery_tick, 0); update_battery(); }
M src/clock/clock.csrc/clock/clock.c

@@ -51,7 +51,7 @@ static char buf_time[256];

static char buf_date[256]; static char buf_tooltip[512]; int clock_enabled; -static Timer clock_timeout; +static Timer clock_timer; void clock_init_fonts(); char *clock_get_tooltip(void *obj);

@@ -65,7 +65,7 @@ time1_format = NULL;

time1_timezone = NULL; time2_format = NULL; time2_timezone = NULL; - INIT_TIMER(clock_timeout); + INIT_TIMER(clock_timer); time_tooltip_format = NULL; time_tooltip_timezone = NULL; clock_lclick_command = NULL;

@@ -110,7 +110,7 @@ free(clock_uwheel_command);

clock_uwheel_command = NULL; free(clock_dwheel_command); clock_dwheel_command = NULL; - destroy_timer(&clock_timeout); + destroy_timer(&clock_timer); } struct tm *clock_gettime_for_tz(const char *timezone)

@@ -154,7 +154,7 @@ void update_clocks_sec(void *arg)

{ gettimeofday(&time_clock, 0); update_clocks(); - change_timer(&clock_timeout, true, ms_until_second_change(&time_clock), 0, update_clocks_sec, 0); + change_timer(&clock_timer, true, ms_until_second_change(&time_clock), 0, update_clocks_sec, 0); } void update_clocks_min(void *arg)

@@ -166,7 +166,7 @@ gettimeofday(&time_clock, 0);

if (time_clock.tv_sec % 60 == 0 || time_clock.tv_sec - old_sec > 60 || (time1_format && !buf_time[0]) || (time2_format && !buf_date[0])) update_clocks(); old_sec = time_clock.tv_sec; - change_timer(&clock_timeout, true, ms_until_second_change(&time_clock), 0, update_clocks_min, 0); + change_timer(&clock_timer, true, ms_until_second_change(&time_clock), 0, update_clocks_min, 0); } gboolean time_format_needs_sec_ticks(char *time_format)

@@ -215,7 +215,7 @@ clock->area._get_tooltip_text = clock_get_tooltip;

strftime(buf_tooltip, sizeof(buf_tooltip), time_tooltip_format, clock_gettime_for_tz(time_tooltip_timezone)); } - if (!clock_timeout.enabled_) { + if (!clock_timer.enabled_) { if (time_format_needs_sec_ticks(time1_format) || time_format_needs_sec_ticks(time2_format)) { update_clocks_sec(NULL); } else {
M src/panel.csrc/panel.c

@@ -145,7 +145,7 @@ p->hidden_pixmap = 0;

if (p->main_win) XDestroyWindow(server.display, p->main_win); p->main_win = 0; - destroy_timer(&p->autohide_timeout); + destroy_timer(&p->autohide_timer); cleanup_freespace(p); }

@@ -207,7 +207,7 @@

panels = calloc(num_panels, sizeof(Panel)); for (int i = 0; i < num_panels; i++) { memcpy(&panels[i], &panel_config, sizeof(Panel)); - INIT_TIMER(panels[i].autohide_timeout); + INIT_TIMER(panels[i].autohide_timer); } fprintf(stderr,

@@ -1061,15 +1061,15 @@ }

return NULL; } -void stop_autohide_timeout(Panel *p) +void stop_autohide_timer(Panel *p) { - stop_timer(&p->autohide_timeout); + stop_timer(&p->autohide_timer); } void autohide_show(void *p) { Panel *panel = (Panel *)p; - stop_autohide_timeout(panel); + stop_autohide_timer(panel); panel->is_hidden = 0; XMapSubwindows(server.display, panel->main_win); // systray windows set_panel_window_geometry(panel);

@@ -1081,7 +1081,7 @@

void autohide_hide(void *p) { Panel *panel = (Panel *)p; - stop_autohide_timeout(panel); + stop_autohide_timer(panel); set_panel_layer(panel, panel_layer); panel->is_hidden = TRUE; XUnmapSubwindows(server.display, panel->main_win); // systray windows

@@ -1093,7 +1093,7 @@ void autohide_trigger_show(Panel *p)

{ if (!p) return; - change_timer(&p->autohide_timeout, true, panel_autohide_show_timeout, 0, autohide_show, p); + change_timer(&p->autohide_timer, true, panel_autohide_show_timeout, 0, autohide_show, p); } void autohide_trigger_hide(Panel *p)

@@ -1108,7 +1108,7 @@ if (XQueryPointer(server.display, p->main_win, &root, &child, &xr, &yr, &xw, &yw, &mask))

if (child) return; // mouse over one of the system tray icons - change_timer(&p->autohide_timeout, true, panel_autohide_hide_timeout, 0, autohide_hide, p); + change_timer(&p->autohide_timer, true, panel_autohide_hide_timeout, 0, autohide_hide, p); } void shrink_panel(Panel *panel)
M src/panel.hsrc/panel.h

@@ -144,7 +144,7 @@ // Autohide

gboolean is_hidden; int hidden_width, hidden_height; Pixmap hidden_pixmap; - Timer autohide_timeout; + Timer autohide_timer; } Panel; extern Panel panel_config;
M src/systray/systraybar.csrc/systray/systraybar.c

@@ -730,8 +730,8 @@ // to prevent graphical corruptions in icons with fake transparency

traywin->pid = pid; traywin->name = name; traywin->chrono = chrono; - INIT_TIMER(traywin->render_timeout); - INIT_TIMER(traywin->resize_timeout); + INIT_TIMER(traywin->render_timer); + INIT_TIMER(traywin->resize_timer); chrono++; show(&systray.area);

@@ -942,8 +942,8 @@ XReparentWindow(server.display, traywin->win, server.root_win, 0, 0);

XDestroyWindow(server.display, traywin->parent); XSync(server.display, False); XSetErrorHandler(old); - destroy_timer(&traywin->render_timeout); - destroy_timer(&traywin->resize_timeout); + destroy_timer(&traywin->render_timer); + destroy_timer(&traywin->resize_timer); free(traywin->name); if (traywin->image) { imlib_context_set_image(traywin->image);

@@ -1057,8 +1057,8 @@ }

if (traywin->bad_size_counter < min_bad_resize_events) { systray_resize_icon(traywin); } else { - if (!traywin->resize_timeout.enabled_) - change_timer(&traywin->resize_timeout, true, fast_resize_period, 0, systray_resize_icon, traywin); + if (!traywin->resize_timer.enabled_) + change_timer(&traywin->resize_timer, true, fast_resize_period, 0, systray_resize_icon, traywin); } } else { if (traywin->bad_size_counter == max_bad_resize_events) {

@@ -1072,13 +1072,13 @@ // Delayed resize

// FIXME Normally we should force the icon to resize fill_color to the size we resized it to when we // embedded it. // However this triggers a resize loop in new versions of GTK, which we must avoid. - if (!traywin->resize_timeout.enabled_) - change_timer(&traywin->resize_timeout, true, slow_resize_period, 0, systray_resize_icon, traywin); + if (!traywin->resize_timer.enabled_) + change_timer(&traywin->resize_timer, true, slow_resize_period, 0, systray_resize_icon, traywin); return; } } else { // Correct size - stop_timer(&traywin->resize_timeout); + stop_timer(&traywin->resize_timer); } // Resize and redraw the systray

@@ -1135,8 +1135,8 @@ }

if (traywin->bad_size_counter < min_bad_resize_events) { systray_resize_icon(traywin); } else { - if (!traywin->resize_timeout.enabled_) - change_timer(&traywin->resize_timeout, true, fast_resize_period, 0, systray_resize_icon, traywin); + if (!traywin->resize_timer.enabled_) + change_timer(&traywin->resize_timer, true, fast_resize_period, 0, systray_resize_icon, traywin); } } else { if (traywin->bad_size_counter == max_bad_resize_events) {

@@ -1149,13 +1149,13 @@ }

// Delayed resize // FIXME Normally we should force the icon to resize to the size we resized it to when we embedded it. // However this triggers a resize loop in some versions of GTK, which we must avoid. - if (!traywin->resize_timeout.enabled_) - change_timer(&traywin->resize_timeout, true, slow_resize_period, 0, systray_resize_icon, traywin); + if (!traywin->resize_timer.enabled_) + change_timer(&traywin->resize_timer, true, slow_resize_period, 0, systray_resize_icon, traywin); return; } } else { // Correct size - stop_timer(&traywin->resize_timeout); + stop_timer(&traywin->resize_timer); } // Resize and redraw the systray

@@ -1222,7 +1222,7 @@ struct timespec earliest_render = add_msec_to_timespec(traywin->time_last_render, min_refresh_period);

if (compare_timespecs(&earliest_render, &now) > 0) { traywin->num_fast_renders++; if (traywin->num_fast_renders > max_fast_refreshes) { - change_timer(&traywin->render_timeout, true, min_refresh_period, 0, systray_render_icon_composited, traywin); + change_timer(&traywin->render_timer, true, min_refresh_period, 0, systray_render_icon_composited, traywin); if (systray_profile) fprintf(stderr, YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",

@@ -1241,7 +1241,7 @@ }

if (traywin->width == 0 || traywin->height == 0) { // reschedule rendering since the geometry information has not yet been processed (can happen on slow cpu) - change_timer(&traywin->render_timeout, true, min_refresh_period, 0, systray_render_icon_composited, traywin); + change_timer(&traywin->render_timer, true, min_refresh_period, 0, systray_render_icon_composited, traywin); if (systray_profile) fprintf(stderr, YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",

@@ -1253,9 +1253,7 @@ traywin->name);

return; } - if (traywin->render_timeout.enabled_) { - stop_timer(&traywin->render_timeout); - } + stop_timer(&traywin->render_timer); // good systray icons support 32 bit depth, but some icons are still 24 bit. // We create a heuristic mask for these icons, i.e. we get the rgb value in the top left corner, and

@@ -1418,8 +1416,7 @@ // __func__,

// __LINE__, // traywin->win, // traywin->name); - stop_timer(&traywin->render_timeout); - change_timer(&traywin->render_timeout, true, min_refresh_period, 0, systray_render_icon, traywin); + change_timer(&traywin->render_timer, true, min_refresh_period, 0, systray_render_icon, traywin); return; }

@@ -1442,17 +1439,13 @@ int xpos, ypos;

unsigned int width, height, depth; Window root; if (!XGetGeometry(server.display, traywin->win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) { - stop_timer(&traywin->render_timeout); - if (!traywin->render_timeout.enabled_) - change_timer(&traywin->render_timeout, true, min_refresh_period, 0, systray_render_icon, traywin); + change_timer(&traywin->render_timer, true, min_refresh_period, 0, systray_render_icon, traywin); systray_render_icon_from_image(traywin); XSetErrorHandler(old); return; } else { if (xpos != 0 || ypos != 0 || width != traywin->width || height != traywin->height) { - stop_timer(&traywin->render_timeout); - if (!traywin->render_timeout.enabled_) - change_timer(&traywin->render_timeout, true, min_refresh_period, 0, systray_render_icon, traywin); + change_timer(&traywin->render_timer, true, min_refresh_period, 0, systray_render_icon, traywin); systray_render_icon_from_image(traywin); if (systray_profile) fprintf(stderr,
M src/systray/systraybar.hsrc/systray/systraybar.h

@@ -56,11 +56,11 @@ char *name;

// Members used for rendering struct timespec time_last_render; int num_fast_renders; - Timer render_timeout; + Timer render_timer; // Members used for resizing int bad_size_counter; struct timespec time_last_resize; - Timer resize_timeout; + Timer resize_timer; // Icon contents if we are compositing the icon, otherwise null Imlib_Image image; // XDamage
M src/tooltip/tooltip.csrc/tooltip/tooltip.c

@@ -31,9 +31,9 @@ static int x, y, width, height;

static gboolean just_shown; // the next functions are helper functions for tooltip handling -void start_show_timeout(); -void start_hide_timeout(); -void stop_tooltip_timeout(); +void start_show_timer(); +void start_hide_timer(); +void stop_tooltip_timer(); void tooltip_init_fonts();

@@ -44,8 +44,8 @@ {

// give the tooltip some reasonable default values memset(&g_tooltip, 0, sizeof(Tooltip)); - INIT_TIMER(g_tooltip.timeout); - INIT_TIMER(g_tooltip.update_timeout); + INIT_TIMER(g_tooltip.visibility_timer); + INIT_TIMER(g_tooltip.update_timer); g_tooltip.font_color.rgb[0] = 1; g_tooltip.font_color.rgb[1] = 1;

@@ -56,9 +56,9 @@ }

void cleanup_tooltip() { - stop_tooltip_timeout(); - destroy_timer(&g_tooltip.timeout); - destroy_timer(&g_tooltip.update_timeout); + stop_tooltip_timer(); + destroy_timer(&g_tooltip.visibility_timer); + destroy_timer(&g_tooltip.update_timer); tooltip_hide(NULL); tooltip_update_contents_for(NULL); if (g_tooltip.window)

@@ -125,9 +125,9 @@ g_tooltip.panel = p;

if (g_tooltip.mapped && g_tooltip.area != area) { tooltip_update_contents_for(area); tooltip_update(); - stop_tooltip_timeout(); + stop_tooltip_timer(); } else if (!g_tooltip.mapped) { - start_show_timeout(); + start_show_timer(); } }

@@ -310,10 +310,10 @@ void tooltip_trigger_hide()

{ if (g_tooltip.mapped) { tooltip_update_contents_for(NULL); - start_hide_timeout(); + start_hide_timer(); } else { - // tooltip not visible yet, but maybe a timeout is still pending - stop_tooltip_timeout(); + // tooltip not visible yet, but maybe a timer is still pending + stop_tooltip_timer(); } }

@@ -327,19 +327,19 @@ }

g_tooltip.area = NULL; } -void start_show_timeout() +void start_show_timer() { - change_timer(&g_tooltip.timeout, true, g_tooltip.show_timeout_msec, 0, tooltip_show, 0); + change_timer(&g_tooltip.visibility_timer, true, g_tooltip.show_timeout_msec, 0, tooltip_show, 0); } -void start_hide_timeout() +void start_hide_timer() { - change_timer(&g_tooltip.timeout, true, g_tooltip.hide_timeout_msec, 0, tooltip_hide, 0); + change_timer(&g_tooltip.visibility_timer, true, g_tooltip.hide_timeout_msec, 0, tooltip_hide, 0); } -void stop_tooltip_timeout() +void stop_tooltip_timer() { - stop_timer(&g_tooltip.timeout); + stop_timer(&g_tooltip.visibility_timer); } void tooltip_update_contents_timeout(void *arg)

@@ -360,7 +360,7 @@ g_tooltip.image = area->_get_tooltip_image(area);

if (g_tooltip.image) cairo_surface_reference(g_tooltip.image); else - change_timer(&g_tooltip.update_timeout, true, 300, 0, tooltip_update_contents_timeout, NULL); + change_timer(&g_tooltip.update_timer, true, 300, 0, tooltip_update_contents_timeout, NULL); } g_tooltip.area = area; }
M src/tooltip/tooltip.hsrc/tooltip/tooltip.h

@@ -36,8 +36,8 @@ gboolean has_font;

PangoFontDescription *font_desc; Color font_color; Background *bg; - Timer timeout; - Timer update_timeout; + Timer visibility_timer; + Timer update_timer; cairo_surface_t *image; } Tooltip;
M src/util/timer.csrc/util/timer.c

@@ -1239,7 +1239,7 @@ ASSERT_EQUAL(container.triggered, 2);

ASSERT_EQUAL(triggered_other, 0); } -TEST(add_change_two_timeout_simple_inside_callback) +TEST(add_change_two_timer_simple_inside_callback) { u_int64_t origin = MOCK_ORIGIN; TimeoutContainer container;

@@ -1460,7 +1460,7 @@ ASSERT_EQUAL(container.triggered, 3);

ASSERT_EQUAL(triggered_other, 0); } -TEST(add_change_two_timeout_multi_inside_callback) +TEST(add_change_two_timer_multi_inside_callback) { u_int64_t origin = MOCK_ORIGIN; TimeoutContainer container;

@@ -1651,7 +1651,7 @@ ASSERT_EQUAL(triggered, 3);

ASSERT_EQUAL(timeval_to_ms(get_duration_to_next_timer_expiration()), 40); } -TEST(cleanup_timeout_simple) +TEST(cleanup_timers_simple) { u_int64_t origin = MOCK_ORIGIN; int triggered = 0;
M src/util/timer.hsrc/util/timer.h

@@ -62,7 +62,7 @@ // Get the time duration to the next expiration time, or NULL if there is no active timer.

// Do not free the pointer; it is harmless to change its contents. struct timeval *get_duration_to_next_timer_expiration(); -// Callback of all expired timeouts +// Trigger all expired timers, and reschedule them if they are periodic timers void handle_expired_timers(); // Time helper functions.