From cdf6f88a278cc3cc3f7d69912af0135ee60037a1 Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Fri, 8 Mar 2024 22:47:06 +0000 Subject: [PATCH] fix hiding lone titlebar --- sway/desktop/transaction.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 2995965fa..e5fa06a3f 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -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) {