osd: use wlr_output_effective_resolution() to get output geometry

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%
This commit is contained in:
tokyo4j 2025-11-02 01:12:42 +09:00 committed by Johan Malm
parent ef01ebe187
commit 0f62648d39
2 changed files with 8 additions and 3 deletions

View 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; bool show_workspace = wl_list_length(&rc.workspace_config.workspaces) > 1;
const char *workspace_name = server->workspaces.current->name; 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; int w = switcher_theme->width;
if (switcher_theme->width_is_percent) { if (switcher_theme->width_is_percent) {
w = output->wlr_output->width / output->wlr_output->scale w = output_width * switcher_theme->width / 100;
* switcher_theme->width / 100;
} }
int h = wl_array_len(views) * switcher_theme->item_height int h = wl_array_len(views) * switcher_theme->item_height
+ 2 * rc.theme->osd_border_width + 2 * switcher_theme->padding; + 2 * rc.theme->osd_border_width + 2 * switcher_theme->padding;

View file

@ -180,7 +180,9 @@ get_items_geometry(struct output *output, struct theme *theme,
{ {
struct window_switcher_thumbnail_theme *switcher_theme = struct window_switcher_thumbnail_theme *switcher_theme =
&theme->osd_window_switcher_thumbnail; &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 padding = theme->osd_border_width + switcher_theme->padding;
int max_bg_width = switcher_theme->max_width; int max_bg_width = switcher_theme->max_width;