]> git.mdlowis.com Git - proto/labwc.git/commitdiff
osd: use wlr_output_effective_resolution() to get output geometry
authortokyo4j <hrak1529@gmail.com>
Sat, 1 Nov 2025 16:12:42 +0000 (01:12 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 1 Nov 2025 17:03:37 +0000 (17:03 +0000)
Before this commit, output transformations were not taken into account for
parcent-based osd widths like:

osd.window-switcher.style-classic.width: 80%
osd.window-switcher.style-thumbnail.width.max: 80%

src/osd/osd-classic.c
src/osd/osd-thumbnail.c

index 7fd20357835c1082f01f236e3a2c4459bacc76ec..7af728233519cb88003a5eba218b27d53271c6cf 100644 (file)
@@ -84,10 +84,13 @@ osd_classic_create(struct output *output, struct wl_array *views)
        bool show_workspace = wl_list_length(&rc.workspace_config.workspaces) > 1;
        const char *workspace_name = server->workspaces.current->name;
 
+       int output_width, output_height;
+       wlr_output_effective_resolution(output->wlr_output,
+               &output_width, &output_height);
+
        int w = switcher_theme->width;
        if (switcher_theme->width_is_percent) {
-               w = output->wlr_output->width / output->wlr_output->scale
-                       * switcher_theme->width / 100;
+               w = output_width * switcher_theme->width / 100;
        }
        int h = wl_array_len(views) * switcher_theme->item_height
                + 2 * rc.theme->osd_border_width + 2 * switcher_theme->padding;
index 0b98b4d2507076b6322a5fa881550b1eb7ea9eaf..1ba65a79ca7f4fc1697f7427e75f3e41dcdd8f97 100644 (file)
@@ -180,7 +180,9 @@ get_items_geometry(struct output *output, struct theme *theme,
 {
        struct window_switcher_thumbnail_theme *switcher_theme =
                &theme->osd_window_switcher_thumbnail;
-       int output_width = output->wlr_output->width / output->wlr_output->scale;
+       int output_width, output_height;
+       wlr_output_effective_resolution(output->wlr_output,
+               &output_width, &output_height);
        int padding = theme->osd_border_width + switcher_theme->padding;
 
        int max_bg_width = switcher_theme->max_width;