From 47201cab84a96831abf33119ebd200ecb17d6e6b Mon Sep 17 00:00:00 2001 From: o9000 Date: Fri, 17 Nov 2017 15:40:59 +0100 Subject: [PATCH] Taskbar: thumbnails (interleave slow periodic throttling with event processing) --- src/taskbar/taskbar.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/taskbar/taskbar.c b/src/taskbar/taskbar.c index 8016a5c..39d14e2 100644 --- a/src/taskbar/taskbar.c +++ b/src/taskbar/taskbar.c @@ -52,6 +52,7 @@ static timeout *thumbnail_update_timer_active; static timeout *thumbnail_update_timer_tooltip; static GList *taskbar_task_orderings = NULL; +static GList *taskbar_thumbnail_jobs_done = NULL; void taskbar_init_fonts(); int taskbar_compute_desired_size(void *obj); @@ -91,6 +92,7 @@ void default_taskbar() thumbnail_update_timer_all = NULL; thumbnail_update_timer_active = NULL; thumbnail_update_timer_tooltip = NULL; + taskbar_thumbnail_jobs_done = NULL; taskbar_sort_method = TASKBAR_NOSORT; taskbar_alignment = ALIGN_LEFT; default_taskbarname(); @@ -135,6 +137,7 @@ void cleanup_taskbar() stop_timeout(thumbnail_update_timer_all); stop_timeout(thumbnail_update_timer_active); stop_timeout(thumbnail_update_timer_tooltip); + g_list_free(taskbar_thumbnail_jobs_done); taskbar_save_orderings(); if (win_to_task) { while (g_hash_table_size(win_to_task)) { @@ -826,9 +829,11 @@ void taskbar_update_thumbnails(void *arg) c; c = c->next) { Task *t = (Task *)c->data; - if (mode == THUMB_MODE_ALL || (mode == THUMB_MODE_ACTIVE_WINDOW && t->current_state == TASK_ACTIVE) || + if ((mode == THUMB_MODE_ALL && !g_list_find(taskbar_thumbnail_jobs_done, t)) || (mode == THUMB_MODE_ACTIVE_WINDOW && t->current_state == TASK_ACTIVE) || (mode == THUMB_MODE_TOOLTIP_WINDOW && g_tooltip.mapped && g_tooltip.area == &t->area)) { task_refresh_thumbnail(t); + if (mode == THUMB_MODE_ALL) + taskbar_thumbnail_jobs_done = g_list_append(taskbar_thumbnail_jobs_done, t); if (t->thumbnail && mode == THUMB_MODE_TOOLTIP_WINDOW) { taskbar_start_thumbnail_timer(THUMB_MODE_TOOLTIP_WINDOW); } @@ -843,4 +848,11 @@ void taskbar_update_thumbnails(void *arg) } } } + if (mode == THUMB_MODE_ALL) { + if (taskbar_thumbnail_jobs_done) { + g_list_free(taskbar_thumbnail_jobs_done); + taskbar_thumbnail_jobs_done = NULL; + change_timeout(&thumbnail_update_timer_all, 10 * 1000, 10 * 1000, taskbar_update_thumbnails, arg); + } + } }