mirror of
https://github.com/lbonn/rofi
synced 2024-11-23 20:33:03 +00:00
[WaylandWindow] Remove redundant icon fetcher query.
rofi_icon_fetcher is async, so we won't know which query succeeded on the first try. All subsequent attempts use cached_icon_uid, and the result of the first query will never be used. Do the same as XCB window mode and request only lowercase app_id.
This commit is contained in:
parent
2d6d3a2259
commit
42c6697a6b
1 changed files with 9 additions and 18 deletions
|
@ -586,30 +586,21 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
cairo_surface_t *icon = NULL;
|
||||
gchar *transformed = NULL;
|
||||
|
||||
if (toplevel->cached_icon_uid > 0 && toplevel->cached_icon_size == height) {
|
||||
return rofi_icon_fetcher_get(toplevel->cached_icon_uid);
|
||||
}
|
||||
|
||||
/** lookup icon */
|
||||
/**
|
||||
* Lookup icon by lowercase app_id.
|
||||
* There's no API to request multiple names, so we do the same as XCB window
|
||||
* mode and search for a lowercase WM_CLASS/app_id.
|
||||
*/
|
||||
gchar *app_id_lower = g_utf8_strdown(toplevel->app_id, -1);
|
||||
toplevel->cached_icon_size = height;
|
||||
toplevel->cached_icon_uid = rofi_icon_fetcher_query(toplevel->app_id, height);
|
||||
icon = rofi_icon_fetcher_get(toplevel->cached_icon_uid);
|
||||
if (icon) {
|
||||
return icon;
|
||||
}
|
||||
toplevel->cached_icon_uid = rofi_icon_fetcher_query(app_id_lower, height);
|
||||
g_free(app_id_lower);
|
||||
|
||||
/** lookup icon by lowercase app_id */
|
||||
transformed = g_utf8_strdown(toplevel->app_id, strlen(toplevel->app_id));
|
||||
toplevel->cached_icon_uid = rofi_icon_fetcher_query(transformed, height);
|
||||
icon = rofi_icon_fetcher_get(toplevel->cached_icon_uid);
|
||||
g_free(transformed);
|
||||
|
||||
/* TODO: find desktop file by app_id and get the Icon= value */
|
||||
|
||||
return icon;
|
||||
return rofi_icon_fetcher_get(toplevel->cached_icon_uid);
|
||||
}
|
||||
|
||||
#include "mode-private.h"
|
||||
|
|
Loading…
Reference in a new issue