theme: add button padding and spacing (#2127)

While at it, separate corner width from button
width. Both are independed and having them
separately improves readability.
This commit is contained in:
Jens Peters 2024-09-09 17:43:38 +02:00 committed by Johan Malm
parent 8850368ab9
commit 824b0fa4e3
13 changed files with 105 additions and 39 deletions

View file

@ -22,6 +22,7 @@ ssd_border_create(struct ssd *ssd)
int width = view->current.width;
int height = view_effective_height(view, /* use_pending */ false);
int full_width = width + 2 * theme->border_width;
int corner_width = ssd_get_corner_width();
float *color;
struct wlr_scene_tree *parent;
@ -48,8 +49,8 @@ ssd_border_create(struct ssd *ssd)
add_scene_rect(&subtree->parts, LAB_SSD_PART_BOTTOM, parent,
full_width, theme->border_width, 0, height, color);
add_scene_rect(&subtree->parts, LAB_SSD_PART_TOP, parent,
width - 2 * theme->window_button_width, theme->border_width,
theme->border_width + theme->window_button_width,
width - 2 * corner_width, theme->border_width,
theme->border_width + corner_width,
-(ssd->titlebar.height + theme->border_width), color);
} FOR_EACH_END
@ -93,6 +94,7 @@ ssd_border_update(struct ssd *ssd)
int width = view->current.width;
int height = view_effective_height(view, /* use_pending */ false);
int full_width = width + 2 * theme->border_width;
int corner_width = ssd_get_corner_width();
/*
* From here on we have to cover the following border scenarios:
@ -121,10 +123,10 @@ ssd_border_update(struct ssd *ssd)
: 0;
int top_width = ssd->titlebar.height <= 0 || ssd->state.was_squared
? full_width
: width - 2 * theme->window_button_width;
: width - 2 * corner_width;
int top_x = ssd->titlebar.height <= 0 || ssd->state.was_squared
? 0
: theme->border_width + theme->window_button_width;
: theme->border_width + corner_width;
struct ssd_part *part;
struct wlr_scene_rect *rect;