diff --git a/src/osd/osd-classic.c b/src/osd/osd-classic.c index cbe0519d..27c58e17 100644 --- a/src/osd/osd-classic.c +++ b/src/osd/osd-classic.c @@ -82,6 +82,7 @@ osd_classic_create(struct output *output, struct wl_array *views) struct theme *theme = server->theme; struct window_switcher_classic_theme *switcher_theme = &theme->osd_window_switcher_classic; + int padding = theme->osd_border_width + switcher_theme->padding; bool show_workspace = wl_list_length(&rc.workspace_config.workspaces) > 1; const char *workspace_name = server->workspaces.current->name; @@ -93,8 +94,7 @@ osd_classic_create(struct output *output, struct wl_array *views) if (switcher_theme->width_is_percent) { w = output_box.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; + int h = wl_array_len(views) * switcher_theme->item_height + 2 * padding; if (show_workspace) { /* workspace indicator */ h += switcher_theme->item_height; @@ -116,7 +116,7 @@ osd_classic_create(struct output *output, struct wl_array *views) }; lab_scene_rect_create(output->osd_scene.tree, &bg_opts); - int y = theme->osd_border_width + switcher_theme->padding; + int y = padding; /* Draw workspace indicator */ if (show_workspace) { @@ -144,8 +144,7 @@ osd_classic_create(struct output *output, struct wl_array *views) int nr_fields = wl_list_length(&rc.window_switcher.fields); /* This is the width of the area available for text fields */ - int field_widths_sum = w - 2 * theme->osd_border_width - - 2 * switcher_theme->padding + int field_widths_sum = w - 2 * padding - 2 * switcher_theme->item_active_border_width - (nr_fields + 1) * switcher_theme->item_padding_x; if (field_widths_sum <= 0) { @@ -175,8 +174,7 @@ osd_classic_create(struct output *output, struct wl_array *views) * | | * +---------------------------------+ */ - int x = theme->osd_border_width - + switcher_theme->padding + int x = padding + switcher_theme->item_active_border_width + switcher_theme->item_padding_x; struct wlr_scene_tree *item_root = @@ -189,20 +187,17 @@ osd_classic_create(struct output *output, struct wl_array *views) float *active_border_color = switcher_theme->item_active_border_color; /* Highlight around selected window's item */ - int highlight_x = theme->osd_border_width - + switcher_theme->padding; struct lab_scene_rect_options highlight_opts = { .border_colors = (float *[1]) {active_border_color}, .bg_color = active_bg_color, .nr_borders = 1, .border_width = switcher_theme->item_active_border_width, - .width = w - 2 * theme->osd_border_width - - 2 * switcher_theme->padding, + .width = w - 2 * padding, .height = switcher_theme->item_height, }; struct lab_scene_rect *highlight_rect = lab_scene_rect_create( item->active_tree, &highlight_opts); - wlr_scene_node_set_position(&highlight_rect->tree->node, highlight_x, y); + wlr_scene_node_set_position(&highlight_rect->tree->node, padding, y); create_fields_scene(server, *view, item->normal_tree, text_color, bg_color, field_widths_sum, x, y);