Skip to content

Commit 9a75f00

Browse files
RedSoxFanddevault
authored andcommitted
arrange: use int not size_t for title offsets
This changes `apply_tabbed_layout` and `apply_stacked_layout` to use `int` instead of `size_t`. This is necessary for tabbed and stacked containers to be positioned correctly when the y-location is negative. The reasoning for this is signed plus unsigned is always an unsigned value. This was causing the y-location of the container to be positioned near `INT_MIN` due to an unsigned integer underflow
1 parent c02d2a0 commit 9a75f00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sway/tree/arrange.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void apply_tabbed_layout(list_t *children, struct wlr_box *parent) {
9999
}
100100
for (int i = 0; i < children->length; ++i) {
101101
struct sway_container *child = children->items[i];
102-
size_t parent_offset = child->view ? 0 : container_titlebar_height();
102+
int parent_offset = child->view ? 0 : container_titlebar_height();
103103
container_remove_gaps(child);
104104
child->x = parent->x;
105105
child->y = parent->y + parent_offset;
@@ -115,7 +115,7 @@ static void apply_stacked_layout(list_t *children, struct wlr_box *parent) {
115115
}
116116
for (int i = 0; i < children->length; ++i) {
117117
struct sway_container *child = children->items[i];
118-
size_t parent_offset = child->view ? 0 :
118+
int parent_offset = child->view ? 0 :
119119
container_titlebar_height() * children->length;
120120
container_remove_gaps(child);
121121
child->x = parent->x;

0 commit comments

Comments
 (0)