diff --git a/include/mode-private.h b/include/mode-private.h index 7903df5a6..56d4623df 100644 --- a/include/mode-private.h +++ b/include/mode-private.h @@ -76,7 +76,6 @@ typedef char *(*_mode_get_display_value)(const Mode *sw, * @param sw The #Mode pointer * @param selected_line The selected line * @param height The height of the icon - * @param scale The scale of the icon * * Obtains the icon if available * @@ -84,8 +83,7 @@ typedef char *(*_mode_get_display_value)(const Mode *sw, */ typedef cairo_surface_t *(*_mode_get_icon)(const Mode *sw, unsigned int selected_line, - unsigned int height, - guint scale); + unsigned int height); /** * @param sw The #Mode pointer diff --git a/include/mode.h b/include/mode.h index 18032d616..55ef750d9 100644 --- a/include/mode.h +++ b/include/mode.h @@ -133,14 +133,13 @@ char *mode_get_display_value(const Mode *mode, unsigned int selected_line, * @param mode The mode to query * @param selected_line The entry to query * @param height The desired height of the icon. - * @param scale The desired scale of the icon. * * Returns the icon for the selected_line * * @returns allocated new cairo_surface_t if applicable */ cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line, - unsigned int height, guint scale); + unsigned int height); /** * @param mode The mode to query diff --git a/include/rofi-icon-fetcher.h b/include/rofi-icon-fetcher.h index 351f1ad75..34f9cfd21 100644 --- a/include/rofi-icon-fetcher.h +++ b/include/rofi-icon-fetcher.h @@ -26,9 +26,8 @@ void rofi_icon_fetcher_destroy(void); /** * @param name The name of the icon to fetch. * @param size The size of the icon to fetch. - * @param scale The scale of the icon to fetch. * - * Query the icon-theme for icon with name, size, and scale. + * Query the icon-theme for icon with name and size. * The returned icon will be the best match for the requested size, it should * still be resized to the actual size. * @@ -36,16 +35,14 @@ void rofi_icon_fetcher_destroy(void); * * @returns the uid identifying the request. */ -uint32_t rofi_icon_fetcher_query(const char *name, const int size, - const guint scale); +uint32_t rofi_icon_fetcher_query(const char *name, const int size); /** * @param name The name of the icon to fetch. * @param wsize The width of the icon to fetch. * @param hsize The height of the icon to fetch. - * @param scale The scale of the icon to fetch. * - * Query the icon-theme for icon with name, size, and scale. + * Query the icon-theme for icon with name and size. * The returned icon will be the best match for the requested size, it should * still be resized to the actual size. For icons it will take the min of wsize * and hsize. @@ -55,7 +52,7 @@ uint32_t rofi_icon_fetcher_query(const char *name, const int size, * @returns the uid identifying the request. */ uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize, - const int hsize, const guint scale); + const int hsize); /** * @param uid The unique id representing the matching request. diff --git a/include/rofi-types.h b/include/rofi-types.h index 07d21f78e..4fc878d4a 100644 --- a/include/rofi-types.h +++ b/include/rofi-types.h @@ -192,7 +192,6 @@ typedef struct { RofiScaleType scaling; int wsize; int hsize; - guint scale; RofiDirection dir; double angle; diff --git a/source/mode.c b/source/mode.c index da1debc6f..7cb070deb 100644 --- a/source/mode.c +++ b/source/mode.c @@ -85,11 +85,11 @@ char *mode_get_display_value(const Mode *mode, unsigned int selected_line, } cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line, - unsigned int height, guint scale) { + unsigned int height) { g_assert(mode != NULL); if (mode->_get_icon != NULL) { - cairo_surface_t *icon = mode->_get_icon(mode, selected_line, height, scale); + cairo_surface_t *icon = mode->_get_icon(mode, selected_line, height); if (icon) { return icon; } @@ -110,7 +110,7 @@ cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line, rofi_theme_find_property(wid, P_STRING, "fallback-icon", TRUE); if (p != NULL && (p->type == P_STRING && p->value.s)) { mode->fallback_icon_fetch_uid = - rofi_icon_fetcher_query(p->value.s, height, scale); + rofi_icon_fetcher_query(p->value.s, height); return NULL; } } diff --git a/source/modes/combi.c b/source/modes/combi.c index a87f83526..df32f7a6d 100644 --- a/source/modes/combi.c +++ b/source/modes/combi.c @@ -286,12 +286,12 @@ static char *combi_get_completion(const Mode *sw, unsigned int index) { } static cairo_surface_t *combi_get_icon(const Mode *sw, unsigned int index, - unsigned int height, guint scale) { + unsigned int height) { CombiModePrivateData *pd = mode_get_private_data(sw); for (unsigned i = 0; i < pd->num_switchers; i++) { if (index >= pd->starts[i] && index < (pd->starts[i] + pd->lengths[i])) { - cairo_surface_t *icon = mode_get_icon( - pd->switchers[i].mode, index - pd->starts[i], height, scale); + cairo_surface_t *icon = + mode_get_icon(pd->switchers[i].mode, index - pd->starts[i], height); return icon; } } @@ -342,5 +342,5 @@ Mode combi_mode = {.name = "combi", ._get_icon = combi_get_icon, ._preprocess_input = combi_preprocess_input, .private_data = NULL, - .free = NULL, - .type = MODE_TYPE_SWITCHER }; + .free = NULL, + .type = MODE_TYPE_SWITCHER}; diff --git a/source/modes/dmenu.c b/source/modes/dmenu.c index d82d49fa9..b44b69fb7 100644 --- a/source/modes/dmenu.c +++ b/source/modes/dmenu.c @@ -29,6 +29,7 @@ #define G_LOG_DOMAIN "Modes.DMenu" #include "config.h" +#include "display.h" #include "helper.h" #include "modes/dmenu.h" #include "rofi-icon-fetcher.h" @@ -57,9 +58,8 @@ static int dmenu_mode_init(Mode *sw); static int dmenu_token_match(const Mode *sw, rofi_int_matcher **tokens, unsigned int index); -static cairo_surface_t *dmenu_get_icon(const Mode *sw, - unsigned int selected_line, - unsigned int height, guint scale); +static cairo_surface_t * +dmenu_get_icon(const Mode *sw, unsigned int selected_line, unsigned int height); static char *dmenu_get_message(const Mode *sw); static inline unsigned int bitget(uint32_t const *const array, @@ -698,9 +698,9 @@ static char *dmenu_get_message(const Mode *sw) { } static cairo_surface_t *dmenu_get_icon(const Mode *sw, unsigned int selected_line, - unsigned int height, - guint scale) { + unsigned int height) { DmenuModePrivateData *pd = (DmenuModePrivateData *)mode_get_private_data(sw); + const guint scale = display_scale(); g_return_val_if_fail(pd->cmd_list != NULL, NULL); DmenuScriptEntry *dr = &(pd->cmd_list[selected_line]); @@ -712,7 +712,7 @@ static cairo_surface_t *dmenu_get_icon(const Mode *sw, return rofi_icon_fetcher_get(dr->icon_fetch_uid); } uint32_t uid = dr->icon_fetch_uid = - rofi_icon_fetcher_query(dr->icon_name, height, scale); + rofi_icon_fetcher_query(dr->icon_name, height); dr->icon_fetch_size = height; dr->icon_fetch_scale = scale; diff --git a/source/modes/drun.c b/source/modes/drun.c index 265a4ad46..cb76f0272 100644 --- a/source/modes/drun.c +++ b/source/modes/drun.c @@ -44,6 +44,7 @@ #include #include +#include "display.h" #include "helper.h" #include "history.h" #include "mode-private.h" @@ -1349,11 +1350,11 @@ static char *_get_display_value(const Mode *sw, unsigned int selected_line, } static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, - unsigned int height, guint scale) { + unsigned int height) { DRunModePrivateData *pd = (DRunModePrivateData *)mode_get_private_data(sw); + const guint scale = display_scale(); if (pd->file_complete) { - return pd->completer->_get_icon(pd->completer, selected_line, height, - scale); + return pd->completer->_get_icon(pd->completer, selected_line, height); } g_return_val_if_fail(pd->entry_list != NULL, NULL); DRunModeEntry *dr = &(pd->entry_list[selected_line]); @@ -1363,7 +1364,7 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid); return icon; } - dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->icon_name, height, scale); + dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->icon_name, height); dr->icon_fetch_size = height; dr->icon_fetch_scale = scale; cairo_surface_t *icon = rofi_icon_fetcher_get(dr->icon_fetch_uid); diff --git a/source/modes/filebrowser.c b/source/modes/filebrowser.c index 782390b32..7eb5ab6f0 100644 --- a/source/modes/filebrowser.c +++ b/source/modes/filebrowser.c @@ -37,6 +37,7 @@ #include #include +#include "display.h" #include "helper.h" #include "history.h" #include "mode-private.h" @@ -608,9 +609,10 @@ static int file_browser_token_match(const Mode *sw, rofi_int_matcher **tokens, } static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, - unsigned int height, guint scale) { + unsigned int height) { FileBrowserModePrivateData *pd = (FileBrowserModePrivateData *)mode_get_private_data(sw); + const guint scale = display_scale(); g_return_val_if_fail(pd->array != NULL, NULL); FBFile *dr = &(pd->array[selected_line]); if (dr->icon_fetch_uid > 0 && dr->icon_fetch_size == height && @@ -618,9 +620,9 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, return rofi_icon_fetcher_get(dr->icon_fetch_uid); } if (rofi_icon_fetcher_file_is_image(dr->path)) { - dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->path, height, scale); + dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->path, height); } else { - dr->icon_fetch_uid = rofi_icon_fetcher_query(icon_name[dr->type], height, scale); + dr->icon_fetch_uid = rofi_icon_fetcher_query(icon_name[dr->type], height); } dr->icon_fetch_size = height; dr->icon_fetch_scale = scale; diff --git a/source/modes/recursivebrowser.c b/source/modes/recursivebrowser.c index 40308796e..2943778e1 100644 --- a/source/modes/recursivebrowser.c +++ b/source/modes/recursivebrowser.c @@ -40,6 +40,7 @@ #include #include +#include "display.h" #include "helper.h" #include "history.h" #include "mode-private.h" @@ -73,6 +74,7 @@ typedef struct { enum FBFileType type; uint32_t icon_fetch_uid; uint32_t icon_fetch_size; + guint icon_fetch_scale; gboolean link; time_t time; } FBFile; @@ -212,6 +214,7 @@ static void scan_dir(FileBrowserModePrivateData *pd, GFile *path) { f->type = (rd->d_type == DT_DIR) ? DIRECTORY : RFILE; f->icon_fetch_uid = 0; f->icon_fetch_size = 0; + f->icon_fetch_scale = 0; f->link = FALSE; g_async_queue_push(pd->async_queue, f); @@ -238,6 +241,7 @@ static void scan_dir(FileBrowserModePrivateData *pd, GFile *path) { } f->icon_fetch_uid = 0; f->icon_fetch_size = 0; + f->icon_fetch_scale = 0; f->link = TRUE; // Default to file. f->type = RFILE; @@ -440,21 +444,24 @@ static int recursive_browser_token_match(const Mode *sw, } static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, - unsigned int height, guint scale) { + unsigned int height) { FileBrowserModePrivateData *pd = (FileBrowserModePrivateData *)mode_get_private_data(sw); + const guint scale = display_scale(); g_return_val_if_fail(pd->array != NULL, NULL); FBFile *dr = &(pd->array[selected_line]); - if (dr->icon_fetch_uid > 0 && dr->icon_fetch_size == height) { + if (dr->icon_fetch_uid > 0 && dr->icon_fetch_size == height && + dr->icon_fetch_scale == scale) { return rofi_icon_fetcher_get(dr->icon_fetch_uid); } if (rofi_icon_fetcher_file_is_image(dr->path)) { - dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->path, height, scale); + dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->path, height); } else { dr->icon_fetch_uid = - rofi_icon_fetcher_query(rb_icon_name[dr->type], height, scale); + rofi_icon_fetcher_query(rb_icon_name[dr->type], height); } dr->icon_fetch_size = height; + dr->icon_fetch_scale = scale; return rofi_icon_fetcher_get(dr->icon_fetch_uid); } diff --git a/source/modes/run.c b/source/modes/run.c index 73821413f..9649982f6 100644 --- a/source/modes/run.c +++ b/source/modes/run.c @@ -46,6 +46,7 @@ #include #include +#include "display.h" #include "helper.h" #include "history.h" #include "modes/filebrowser.h" @@ -538,11 +539,11 @@ static char *run_get_message(const Mode *sw) { return NULL; } static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, - unsigned int height, guint scale) { + unsigned int height) { RunModePrivateData *pd = (RunModePrivateData *)mode_get_private_data(sw); + const guint scale = display_scale(); if (pd->file_complete) { - return pd->completer->_get_icon(pd->completer, selected_line, height, - scale); + return pd->completer->_get_icon(pd->completer, selected_line, height); } g_return_val_if_fail(pd->cmd_list != NULL, NULL); RunEntry *dr = &(pd->cmd_list[selected_line]); @@ -555,7 +556,7 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, /** lookup icon */ char **str = g_strsplit(dr->entry, " ", 2); if (str) { - dr->icon_fetch_uid = rofi_icon_fetcher_query(str[0], height, scale); + dr->icon_fetch_uid = rofi_icon_fetcher_query(str[0], height); dr->icon_fetch_size = height; dr->icon_fetch_scale = scale; g_strfreev(str); diff --git a/source/modes/script.c b/source/modes/script.c index f91bf4442..824a1bee8 100644 --- a/source/modes/script.c +++ b/source/modes/script.c @@ -29,6 +29,7 @@ #define G_LOG_DOMAIN "Modes.Script" #include "modes/script.h" +#include "display.h" #include "helper.h" #include "rofi.h" #include @@ -481,9 +482,10 @@ static char *script_get_message(const Mode *sw) { } static cairo_surface_t *script_get_icon(const Mode *sw, unsigned int selected_line, - unsigned int height, guint scale) { + unsigned int height) { ScriptModePrivateData *pd = (ScriptModePrivateData *)mode_get_private_data(sw); + const guint scale = display_scale(); g_return_val_if_fail(pd->cmd_list != NULL, NULL); DmenuScriptEntry *dr = &(pd->cmd_list[selected_line]); if (dr->icon_name == NULL) { @@ -493,7 +495,7 @@ static cairo_surface_t *script_get_icon(const Mode *sw, dr->icon_fetch_scale == scale) { return rofi_icon_fetcher_get(dr->icon_fetch_uid); } - dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->icon_name, height, scale); + dr->icon_fetch_uid = rofi_icon_fetcher_query(dr->icon_name, height); dr->icon_fetch_size = height; dr->icon_fetch_scale = scale; return rofi_icon_fetcher_get(dr->icon_fetch_uid); diff --git a/source/modes/wayland-window.c b/source/modes/wayland-window.c index fe7177b19..72aad61f7 100644 --- a/source/modes/wayland-window.c +++ b/source/modes/wayland-window.c @@ -37,6 +37,7 @@ #include #include +#include "display.h" #include "helper.h" #include "modes/wayland-window.h" #include "rofi.h" @@ -572,9 +573,10 @@ static char *_get_display_value(const Mode *sw, unsigned int selected_line, } static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, - unsigned int height, guint scale) { + unsigned int height) { WaylandWindowModePrivateData *pd = (WaylandWindowModePrivateData *)mode_get_private_data(sw); + const guint scale = display_scale(); g_return_val_if_fail(pd != NULL, NULL); @@ -600,7 +602,7 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, gchar *app_id_lower = g_utf8_strdown(toplevel->app_id, -1); toplevel->cached_icon_size = height; toplevel->cached_icon_scale = scale; - toplevel->cached_icon_uid = rofi_icon_fetcher_query(app_id_lower, height, scale); + toplevel->cached_icon_uid = rofi_icon_fetcher_query(app_id_lower, height); g_free(app_id_lower); return rofi_icon_fetcher_get(toplevel->cached_icon_uid); diff --git a/source/modes/window.c b/source/modes/window.c index 062d6bb76..4f5ad2a94 100644 --- a/source/modes/window.c +++ b/source/modes/window.c @@ -49,6 +49,7 @@ #include "xcb-internal.h" #include "xcb.h" +#include "display.h" #include "helper.h" #include "modes/window.h" #include "rofi.h" @@ -972,7 +973,7 @@ static cairo_user_data_key_t data_key; static cairo_surface_t *draw_surface_from_data(uint32_t width, uint32_t height, uint32_t const *const data) { // limit surface size. - if ( width >= 65536 || height >= 65536){ + if (width >= 65536 || height >= 65536) { return NULL; } uint32_t len = width * height; @@ -1065,8 +1066,9 @@ static cairo_surface_t *get_net_wm_icon(xcb_window_t xid, return surface; } static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, - unsigned int size, guint scale) { + unsigned int size) { WindowModePrivateData *rmpd = mode_get_private_data(sw); + const guint scale = display_scale(); client *c = window_client(rmpd, rmpd->ids->array[selected_line]); if (c == NULL) { return NULL; @@ -1093,9 +1095,10 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, if (c->icon == NULL && c->class && c->icon_theme_checked == FALSE) { if (c->icon_fetch_uid == 0) { char *class_lower = g_utf8_strdown(c->class, -1); - c->icon_fetch_uid = rofi_icon_fetcher_query(class_lower, size, scale); + c->icon_fetch_uid = rofi_icon_fetcher_query(class_lower, size); g_free(class_lower); c->icon_fetch_size = size; + c->icon_fetch_scale = scale; } c->icon_theme_checked = rofi_icon_fetcher_get_ex(c->icon_fetch_uid, &(c->icon)); @@ -1106,9 +1109,9 @@ static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line, } else { if (c->icon == NULL && c->class && c->icon_theme_checked == FALSE) { if (c->icon_fetch_uid == 0 || c->icon_fetch_size != size || - c->icon_fetch_size != scale) { + c->icon_fetch_scale != scale) { char *class_lower = g_utf8_strdown(c->class, -1); - c->icon_fetch_uid = rofi_icon_fetcher_query(class_lower, size, scale); + c->icon_fetch_uid = rofi_icon_fetcher_query(class_lower, size); g_free(class_lower); c->icon_fetch_size = size; c->icon_fetch_scale = scale; @@ -1143,8 +1146,8 @@ Mode window_mode = {.name = "window", ._get_completion = NULL, ._preprocess_input = NULL, .private_data = NULL, - .free = NULL, - .type = MODE_TYPE_SWITCHER }; + .free = NULL, + .type = MODE_TYPE_SWITCHER}; Mode window_mode_cd = {.name = "windowcd", .cfg_name_key = "display-windowcd", ._init = window_mode_init_cd, @@ -1158,6 +1161,6 @@ Mode window_mode_cd = {.name = "windowcd", ._preprocess_input = NULL, .private_data = NULL, .free = NULL, - .type = MODE_TYPE_SWITCHER }; + .type = MODE_TYPE_SWITCHER}; #endif // WINDOW_MODE diff --git a/source/rofi-icon-fetcher.c b/source/rofi-icon-fetcher.c index bf6efc435..920e6d748 100644 --- a/source/rofi-icon-fetcher.c +++ b/source/rofi-icon-fetcher.c @@ -383,7 +383,7 @@ static void rofi_icon_fetcher_worker(thread_state *sdata, } uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize, - const int hsize, const guint scale) { + const int hsize) { g_debug("Query: %s(%dx%d)", name, wsize, hsize); IconFetcherNameEntry *entry = g_hash_table_lookup(rofi_icon_fetcher_data->icon_cache, name); @@ -393,6 +393,7 @@ uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize, g_hash_table_insert(rofi_icon_fetcher_data->icon_cache, entry->name, entry); } IconFetcherEntry *sentry; + const guint scale = display_scale(); for (GList *iter = g_list_first(entry->sizes); iter; iter = g_list_next(iter)) { sentry = iter->data; @@ -422,8 +423,7 @@ uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize, return sentry->uid; } -uint32_t rofi_icon_fetcher_query(const char *name, const int size, - const guint scale) { +uint32_t rofi_icon_fetcher_query(const char *name, const int size) { g_debug("Query: %s(%d)", name, size); IconFetcherNameEntry *entry = g_hash_table_lookup(rofi_icon_fetcher_data->icon_cache, name); @@ -433,6 +433,7 @@ uint32_t rofi_icon_fetcher_query(const char *name, const int size, g_hash_table_insert(rofi_icon_fetcher_data->icon_cache, entry->name, entry); } IconFetcherEntry *sentry; + const guint scale = display_scale(); for (GList *iter = g_list_first(entry->sizes); iter; iter = g_list_next(iter)) { sentry = iter->data; diff --git a/source/theme.c b/source/theme.c index b9f3a1b25..30106f485 100644 --- a/source/theme.c +++ b/source/theme.c @@ -1114,14 +1114,21 @@ static gboolean rofi_theme_get_image_inside(Property *p, const widget *widget, default: break; } +#if 0 + // FIXME: we cannot avoid the query because adding the `scale` field to + // RofiImage breaks ABI compatibility with rofi if (p->value.image.surface_id == 0 || p->value.image.wsize != wsize || p->value.image.hsize != hsize || p->value.image.scale != scale) { - p->value.image.surface_id = rofi_icon_fetcher_query_advanced( - p->value.image.url, wsize, hsize, scale); + p->value.image.surface_id = + rofi_icon_fetcher_query_advanced(p->value.image.url, wsize, hsize); p->value.image.wsize = wsize; p->value.image.hsize = hsize; p->value.image.scale = scale; } +#else + p->value.image.surface_id = + rofi_icon_fetcher_query_advanced(p->value.image.url, wsize, hsize); +#endif cairo_surface_t *img = rofi_icon_fetcher_get(p->value.image.surface_id); if (img != NULL) { @@ -1681,6 +1688,4 @@ gboolean rofi_theme_has_property(const widget *widget, const char *property) { return rofi_theme_has_property_inside(p, widget, property); } -void rofi_theme_set_disp_scale_func(disp_scale_func func) { - disp_scale = func; -} +void rofi_theme_set_disp_scale_func(disp_scale_func func) { disp_scale = func; } diff --git a/source/view.c b/source/view.c index 6686cb475..da8287824 100644 --- a/source/view.c +++ b/source/view.c @@ -122,7 +122,6 @@ static void rofi_view_update_prompt(RofiViewState *state) { } } - extern GList *list_of_warning_msgs; static void rofi_view_reload_message_bar(RofiViewState *state) { if (state->mesg_box == NULL) { @@ -566,8 +565,8 @@ static void selection_changed_callback(G_GNUC_UNUSED listview *lv, int icon_height = widget_get_desired_height(WIDGET(state->icon_current_entry), WIDGET(state->icon_current_entry)->w); - cairo_surface_t *icon = mode_get_icon(state->sw, state->line_map[index], - icon_height, display_scale()); + cairo_surface_t *icon = + mode_get_icon(state->sw, state->line_map[index], icon_height); icon_set_surface(state->icon_current_entry, icon); } else { icon_set_surface(state->icon_current_entry, NULL); @@ -586,8 +585,8 @@ static void update_callback(textbox *t, icon *ico, unsigned int index, if (ico) { int icon_height = widget_get_desired_height(WIDGET(ico), WIDGET(ico)->w); - cairo_surface_t *icon = mode_get_icon(state->sw, state->line_map[index], - icon_height, display_scale()); + cairo_surface_t *icon = + mode_get_icon(state->sw, state->line_map[index], icon_height); icon_set_surface(ico, icon); } if (t) { @@ -830,7 +829,7 @@ void rofi_view_finalize(RofiViewState *state) { * This function should be called when the input of the entry is changed. * TODO: Evaluate if this needs to be a 'signal' on textbox? */ -static void rofi_view_input_changed() { +static void rofi_view_input_changed(void) { rofi_view_take_action("inputchange"); RofiViewState *state = current_active_menu; @@ -896,17 +895,17 @@ static void rofi_view_trigger_global_action(KeyBindingAction action) { } if (data) { #ifdef ENABLE_XCB - if (config.backend == DISPLAY_XCB) { - xcb_stuff_set_clipboard(data); - xcb_set_selection_owner(xcb->connection, CacheState.main_window, - netatoms[CLIPBOARD], XCB_CURRENT_TIME); - xcb_flush(xcb->connection); - } + if (config.backend == DISPLAY_XCB) { + xcb_stuff_set_clipboard(data); + xcb_set_selection_owner(xcb->connection, CacheState.main_window, + netatoms[CLIPBOARD], XCB_CURRENT_TIME); + xcb_flush(xcb->connection); + } #endif #ifdef ENABLE_WAYLAND - if (config.backend == DISPLAY_WAYLAND) { - // TODO - } + if (config.backend == DISPLAY_WAYLAND) { + // TODO + } #endif } } break; diff --git a/source/widgets/icon.c b/source/widgets/icon.c index 12e5a4c8d..ebdd62f5a 100644 --- a/source/widgets/icon.c +++ b/source/widgets/icon.c @@ -29,8 +29,6 @@ #define G_LOG_DOMAIN "Widgets.Icon" #include "config.h" -#include "display.h" - #include "theme.h" #include "widgets/icon.h" #include "widgets/widget-internal.h" @@ -172,7 +170,7 @@ icon *icon_create(widget *parent, const char *name) { const char *filename = rofi_theme_get_string(WIDGET(b), "filename", NULL); if (filename) { - b->icon_fetch_id = rofi_icon_fetcher_query(filename, b->size, display_scale()); + b->icon_fetch_id = rofi_icon_fetcher_query(filename, b->size); } b->yalign = rofi_theme_get_double(WIDGET(b), "vertical-align", 0.5); b->yalign = MAX(0, MIN(1.0, b->yalign)); diff --git a/test/box-test.c b/test/box-test.c index 2696e380f..5025a1636 100644 --- a/test/box-test.c +++ b/test/box-test.c @@ -72,14 +72,12 @@ unsigned int test = 0; ThemeWidget *rofi_configuration = NULL; uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; } diff --git a/test/helper-config-cmdline-parser.c b/test/helper-config-cmdline-parser.c index e6d97fbbf..7f091bc86 100644 --- a/test/helper-config-cmdline-parser.c +++ b/test/helper-config-cmdline-parser.c @@ -57,14 +57,12 @@ static int test = 0; #include "theme.h" ThemeWidget *rofi_theme = NULL; uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; } diff --git a/test/helper-expand.c b/test/helper-expand.c index e60985496..24cf96cb3 100644 --- a/test/helper-expand.c +++ b/test/helper-expand.c @@ -58,14 +58,12 @@ ThemeWidget *rofi_theme = NULL; void rofi_clear_error_messages(void) {} void rofi_clear_warning_messages(void) {} uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; } diff --git a/test/helper-pidfile.c b/test/helper-pidfile.c index e2a3dc571..b7a397ec9 100644 --- a/test/helper-pidfile.c +++ b/test/helper-pidfile.c @@ -48,14 +48,12 @@ static int test = 0; ThemeWidget *rofi_theme = NULL; uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; } diff --git a/test/helper-test.c b/test/helper-test.c index d3584c8ae..ce63e3031 100644 --- a/test/helper-test.c +++ b/test/helper-test.c @@ -74,16 +74,14 @@ gboolean rofi_theme_parse_string(G_GNUC_UNUSED const char *string) { } uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } void rofi_clear_error_messages(void) {} void rofi_clear_warning_messages(void) {} uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; } diff --git a/test/helper-tokenize.c b/test/helper-tokenize.c index c8624d388..21b0ae4e9 100644 --- a/test/helper-tokenize.c +++ b/test/helper-tokenize.c @@ -44,14 +44,12 @@ ThemeWidget *rofi_theme = NULL; uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; } void rofi_clear_error_messages(void) {} diff --git a/test/mode-test.c b/test/mode-test.c index 5458fe559..4ba7548d7 100644 --- a/test/mode-test.c +++ b/test/mode-test.c @@ -49,14 +49,12 @@ ThemeWidget *rofi_theme = NULL; uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; } void rofi_clear_error_messages(void) {} diff --git a/test/scrollbar-test.c b/test/scrollbar-test.c index a6a69851a..7782e130f 100644 --- a/test/scrollbar-test.c +++ b/test/scrollbar-test.c @@ -63,14 +63,12 @@ unsigned int test = 0; ThemeWidget *rofi_configuration = NULL; uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; } diff --git a/test/textbox-test.c b/test/textbox-test.c index cad5d3abd..5208f2600 100644 --- a/test/textbox-test.c +++ b/test/textbox-test.c @@ -59,14 +59,12 @@ unsigned int normal_window_mode = 0; ThemeWidget *rofi_configuration = NULL; uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; } diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c index 1518e9d05..33c9aa680 100644 --- a/test/theme-parser-test.c +++ b/test/theme-parser-test.c @@ -45,16 +45,15 @@ #define REAL_COMPARE_DELTA 0.001 uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } void rofi_clear_error_messages(void) {} void rofi_clear_warning_messages(void) {} -uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { +uint32_t +rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, + G_GNUC_UNUSED G_GNUC_UNUSED const int wsize, + G_GNUC_UNUSED const int hsize) { return 0; } diff --git a/test/widget-test.c b/test/widget-test.c index b58cd49ae..de12d6f90 100644 --- a/test/widget-test.c +++ b/test/widget-test.c @@ -48,14 +48,12 @@ unsigned int test = 0; ThemeWidget *rofi_configuration = NULL; uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name, - G_GNUC_UNUSED const int size, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int size) { return 0; } uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name, G_GNUC_UNUSED const int wsize, - G_GNUC_UNUSED const int hsize, - G_GNUC_UNUSED const guint scale) { + G_GNUC_UNUSED const int hsize) { return 0; }