ssd: apply title layout

This commit is contained in:
Tobias Bengfort 2024-08-18 10:49:18 +02:00
parent 9a252249c9
commit 39ff873d5b
7 changed files with 140 additions and 78 deletions

View file

@ -233,14 +233,17 @@ ssd_update_geometry(struct ssd *ssd)
struct wlr_box cached = ssd->state.geometry;
struct wlr_box current = ssd->view->current;
int min_view_width = rc.theme->window_button_width * SSD_BUTTON_COUNT;
int min_view_width = rc.theme->window_button_width * (
wl_list_length(&rc.title_buttons_left) + wl_list_length(&rc.title_buttons_right));
int eff_width = current.width;
int eff_height = view_effective_height(ssd->view, /* use_pending */ false);
if (eff_width > 0 && eff_width < min_view_width) {
/*
* Prevent negative values in calculations like
* `width - SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT`
* `width - theme->window_button_width
* * (wl_list_length(&rc.title_buttons_left)
* + wl_list_length(&rc.title_buttons_right))`
*/
wlr_log(WLR_ERROR,
"view width is smaller than its minimal value");