From f7fe4846ffa1204b7bc1caed04eaee4ec868b41a Mon Sep 17 00:00:00 2001 From: giomatfois62 Date: Tue, 20 Feb 2024 16:05:50 +0100 Subject: [PATCH] added query_started boolean member to IconFetcherEntry; check if an icon fetcher query was started on an IconFetcherEntry and submit the query again otherwise --- source/rofi-icon-fetcher.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/rofi-icon-fetcher.c b/source/rofi-icon-fetcher.c index c0019148a..ebb880845 100644 --- a/source/rofi-icon-fetcher.c +++ b/source/rofi-icon-fetcher.c @@ -89,6 +89,7 @@ typedef struct { int hsize; cairo_surface_t *surface; gboolean query_done; + gboolean query_started; IconFetcherNameEntry *entry; } IconFetcherEntry; @@ -527,6 +528,8 @@ static void rofi_icon_fetcher_worker(thread_state *sdata, const gchar *icon_path; gchar *icon_path_ = NULL; + sentry->query_started = TRUE; + if (g_str_has_prefix(sentry->entry->name, "thumbnail://")) { // remove uri thumbnail prefix from entry name gchar *entry_name = &sentry->entry->name[12]; @@ -737,6 +740,9 @@ uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize, iter = g_list_next(iter)) { sentry = iter->data; if (sentry->wsize == wsize && sentry->hsize == hsize) { + if (!sentry->query_started) { + g_thread_pool_push(tpool, sentry, NULL); + } return sentry->uid; } } @@ -748,6 +754,7 @@ uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize, sentry->hsize = hsize; sentry->entry = entry; sentry->query_done = FALSE; + sentry->query_started = FALSE; sentry->surface = NULL; entry->sizes = g_list_prepend(entry->sizes, sentry); @@ -775,6 +782,9 @@ uint32_t rofi_icon_fetcher_query(const char *name, const int size) { iter = g_list_next(iter)) { sentry = iter->data; if (sentry->wsize == size && sentry->hsize == size) { + if (!sentry->query_started) { + g_thread_pool_push(tpool, sentry, NULL); + } return sentry->uid; } } @@ -785,6 +795,8 @@ uint32_t rofi_icon_fetcher_query(const char *name, const int size) { sentry->wsize = size; sentry->hsize = size; sentry->entry = entry; + sentry->query_done = FALSE; + sentry->query_started = FALSE; sentry->surface = NULL; entry->sizes = g_list_prepend(entry->sizes, sentry);