aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@users.noreply.github.com>2022-11-12 12:43:55 +0100
committerGitHub <noreply@github.com>2022-11-12 12:43:55 +0100
commit2b236955bd0dbe8a8a7322ecfd59304d6a7e92b8 (patch)
tree67ef9fc005bd46a683329bf9d8e2c0ce4cbb6952
parentbe27a2f50d9e0d3d9b0c5f7c3ad79b548810e194 (diff)
downloadi3-2b236955bd0dbe8a8a7322ecfd59304d6a7e92b8.tar.gz
i3-2b236955bd0dbe8a8a7322ecfd59304d6a7e92b8.zip
use con_border_style() to fix titles in stacked/tabbed containers (#5274)
Previously, the code was directly accessing con->border_style, which circumvents the special-casing for stacked/tabbed containers that forces window titles even for title-less containers. Fixes https://github.com/i3/i3/issues/5269
-rw-r--r--src/con.c19
-rw-r--r--src/x.c6
2 files changed, 15 insertions, 10 deletions
diff --git a/src/con.c b/src/con.c
index e7e865ef..47f75167 100644
--- a/src/con.c
+++ b/src/con.c
@@ -1700,7 +1700,7 @@ static bool has_outer_gaps(gaps_t gaps) {
*/
bool con_draw_decoration_into_frame(Con *con) {
return con_is_leaf(con) &&
- con->border_style == BS_NORMAL &&
+ con_border_style(con) == BS_NORMAL &&
(con->parent == NULL ||
(con->parent->layout != L_TABBED &&
con->parent->layout != L_STACKED));
@@ -1817,14 +1817,19 @@ int con_border_style(Con *con) {
return BS_NONE;
}
- if (con->parent->layout == L_STACKED)
- return (con_num_children(con->parent) == 1 ? con->border_style : BS_NORMAL);
+ if (con->parent != NULL) {
+ if (con->parent->layout == L_STACKED) {
+ return (con_num_children(con->parent) == 1 ? con->border_style : BS_NORMAL);
+ }
- if (con->parent->layout == L_TABBED && con->border_style != BS_NORMAL)
- return (con_num_children(con->parent) == 1 ? con->border_style : BS_NORMAL);
+ if (con->parent->layout == L_TABBED && con->border_style != BS_NORMAL) {
+ return (con_num_children(con->parent) == 1 ? con->border_style : BS_NORMAL);
+ }
- if (con->parent->type == CT_DOCKAREA)
- return BS_NONE;
+ if (con->parent->type == CT_DOCKAREA) {
+ return BS_NONE;
+ }
+ }
return con->border_style;
}
diff --git a/src/x.c b/src/x.c
index 6d444782..9720e833 100644
--- a/src/x.c
+++ b/src/x.c
@@ -618,8 +618,8 @@ void x_draw_decoration(Con *con) {
goto copy_pixmaps;
/* 4: paint the bar */
- DLOG("con->deco_rect = (x=%d, y=%d, w=%d, h=%d)\n",
- con->deco_rect.x, con->deco_rect.y, con->deco_rect.width, con->deco_rect.height);
+ DLOG("con->deco_rect = (x=%d, y=%d, w=%d, h=%d) for con->name=%s\n",
+ con->deco_rect.x, con->deco_rect.y, con->deco_rect.width, con->deco_rect.height, con->name);
draw_util_rectangle(dest_surface, p->color->background,
con->deco_rect.x, con->deco_rect.y, con->deco_rect.width, con->deco_rect.height);
@@ -960,7 +960,7 @@ void x_push_node(Con *con) {
/* The pixmap of a borderless leaf container will not be used except
* for the titlebar in a stack or tabs (issue #1013). */
- bool is_pixmap_needed = ((con_is_leaf(con) && con->border_style != BS_NONE) ||
+ bool is_pixmap_needed = ((con_is_leaf(con) && con_border_style(con) != BS_NONE) ||
con->layout == L_STACKED ||
con->layout == L_TABBED);
DLOG("Con %p (layout %d), is_pixmap_needed = %s, rect.height = %d\n",