aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/arrange.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-06 09:13:36 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-06 09:13:36 +1000
commitc6368febc8045ce884cc0047e89b980d6a81ce2f (patch)
treee2db4a2927bb81e3baf579d01a2bed4f1be62e62 /sway/tree/arrange.c
parentMerge pull request #2572 from RedSoxFan/wlr-output-disabling (diff)
downloadsway-c6368febc8045ce884cc0047e89b980d6a81ce2f.tar.gz
sway-c6368febc8045ce884cc0047e89b980d6a81ce2f.tar.zst
sway-c6368febc8045ce884cc0047e89b980d6a81ce2f.zip
Adjust container box
Prior to f5b9815128b6c000bb5d47c339480fa481a5e99d, children of tabbed and stacked containers would have their container size and position set to the same as the tabbed/stacked container. Normally this would be a problem for a layout such as T[V[view]], but there was some code in the arrange functions which would check if the grandparent of the view was a tabbed or stacked container and would offset the view's Y accordingly. Commit f5b9815128b6c000bb5d47c339480fa481a5e99d changed the box to exclude the titlebar for all tabbed/stacked children so that the grandparent check could be removed. But this meant the title was not covered in the container and wasn't damaged when the child changed its title. This patch changes it so that a child of a tabbed/stacked container will have its box include the title bar if the child is a view, but not if it's a layout container. This fixes the title damage issue while avoiding the grandparent check in the arrange functions, and matches what we see visually.
Diffstat (limited to 'sway/tree/arrange.c')
-rw-r--r--sway/tree/arrange.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index edb05f86..d50be25d 100644
--- a/sway/tree/arrange.c
+++ b/sway/tree/arrange.c
@@ -97,15 +97,14 @@ static void apply_tabbed_layout(list_t *children, struct wlr_box *parent) {
97 if (!children->length) { 97 if (!children->length) {
98 return; 98 return;
99 } 99 }
100 size_t parent_offset = container_titlebar_height();
101 size_t parent_height = parent->height - parent_offset;
102 for (int i = 0; i < children->length; ++i) { 100 for (int i = 0; i < children->length; ++i) {
103 struct sway_container *child = children->items[i]; 101 struct sway_container *child = children->items[i];
102 size_t parent_offset = child->view ? 0 : container_titlebar_height();
104 container_remove_gaps(child); 103 container_remove_gaps(child);
105 child->x = parent->x; 104 child->x = parent->x;
106 child->y = parent->y + parent_offset; 105 child->y = parent->y + parent_offset;
107 child->width = parent->width; 106 child->width = parent->width;
108 child->height = parent_height; 107 child->height = parent->height - parent_offset;
109 container_add_gaps(child); 108 container_add_gaps(child);
110 } 109 }
111} 110}
@@ -114,15 +113,15 @@ static void apply_stacked_layout(list_t *children, struct wlr_box *parent) {
114 if (!children->length) { 113 if (!children->length) {
115 return; 114 return;
116 } 115 }
117 size_t parent_offset = container_titlebar_height() * children->length;
118 size_t parent_height = parent->height - parent_offset;
119 for (int i = 0; i < children->length; ++i) { 116 for (int i = 0; i < children->length; ++i) {
120 struct sway_container *child = children->items[i]; 117 struct sway_container *child = children->items[i];
118 size_t parent_offset = child->view ? 0 :
119 container_titlebar_height() * children->length;
121 container_remove_gaps(child); 120 container_remove_gaps(child);
122 child->x = parent->x; 121 child->x = parent->x;
123 child->y = parent->y + parent_offset; 122 child->y = parent->y + parent_offset;
124 child->width = parent->width; 123 child->width = parent->width;
125 child->height = parent_height; 124 child->height = parent->height - parent_offset;
126 container_add_gaps(child); 125 container_add_gaps(child);
127 } 126 }
128} 127}