diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 218ac5b20a..f571356189 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -287,14 +287,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; } @@ -312,8 +311,7 @@ static void arrange_children(enum sway_container_layout layout, list_t *children wlr_scene_node_reparent(&child->scene_tree->node, content); if (activated) { - arrange_container(child, width, height - title_bar_height, - false, 0); + arrange_container(child, width, height - title_bar_height, false, 0); } else { disable_container(child); } @@ -321,10 +319,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; } @@ -341,8 +338,7 @@ static void arrange_children(enum sway_container_layout layout, list_t *children wlr_scene_node_reparent(&child->scene_tree->node, content); if (activated) { - arrange_container(child, width, height - title_height, - false, 0); + arrange_container(child, width, height - title_height, false, 0); } else { disable_container(child); } @@ -351,7 +347,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; @@ -364,7 +361,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; @@ -454,7 +452,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); } } @@ -534,7 +532,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) {