fix hiding lone titlebar

This commit is contained in:
Sarunas Valaskevicius 2024-03-08 22:47:06 +00:00
parent 41c5ec9698
commit 292e701381

View file

@ -288,14 +288,13 @@ static void arrange_container(struct sway_container *con,
static void arrange_children(enum sway_container_layout layout, list_t *children,
struct sway_container *active, struct wlr_scene_tree *content,
int width, int height, int gaps) {
int width, int height, int gaps, bool parent_asks_for_title_bars) {
int title_bar_height = container_titlebar_height();
if (layout == L_TABBED) {
struct sway_container *first = children->length == 1 ?
((struct sway_container *)children->items[0]) : NULL;
if (config->hide_lone_tab && first && first->view &&
first->current.border != B_NORMAL) {
bool show_titlebar = parent_asks_for_title_bars || !config->hide_lone_tab ||
(children->length > 1);
if (!show_titlebar) {
title_bar_height = 0;
}
@ -322,10 +321,9 @@ static void arrange_children(enum sway_container_layout layout, list_t *children
title_offset = next_title_offset;
}
} else if (layout == L_STACKED) {
struct sway_container *first = children->length == 1 ?
((struct sway_container *)children->items[0]) : NULL;
if (config->hide_lone_tab && first && first->view &&
first->current.border != B_NORMAL) {
bool show_titlebar = parent_asks_for_title_bars || !config->hide_lone_tab ||
(children->length > 1);
if (!show_titlebar) {
title_bar_height = 0;
}
@ -352,7 +350,8 @@ static void arrange_children(enum sway_container_layout layout, list_t *children
}
} else if (layout == L_VERT) {
int off = 0;
bool show_titlebar = !config->hide_lone_tab || (children->length > 1);
bool show_titlebar = parent_asks_for_title_bars || !config->hide_lone_tab ||
(children->length > 1);
for (int i = 0; i < children->length; i++) {
struct sway_container *child = children->items[i];
int cheight = child->current.height;
@ -365,7 +364,8 @@ static void arrange_children(enum sway_container_layout layout, list_t *children
}
} else if (layout == L_HORIZ) {
int off = 0;
bool show_titlebar = !config->hide_lone_tab || (children->length > 1);
bool show_titlebar = parent_asks_for_title_bars || !config->hide_lone_tab ||
(children->length > 1);
for (int i = 0; i < children->length; i++) {
struct sway_container *child = children->items[i];
int cwidth = child->current.width;
@ -455,7 +455,7 @@ static void arrange_container(struct sway_container *con,
arrange_children(con->current.layout, con->current.children,
con->current.focused_inactive_child, con->content_tree,
width, height, gaps);
width, height, gaps, title_bar);
}
}
@ -535,7 +535,7 @@ static void arrange_workspace_tiling(struct sway_workspace *ws,
int width, int height) {
arrange_children(ws->current.layout, ws->current.tiling,
ws->current.focused_inactive_child, ws->layers.tiling,
width, height, ws->gaps_inner);
width, height, ws->gaps_inner, false);
}
static void disable_workspace(struct sway_workspace *ws) {