diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-03-10 15:00:15 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-10 13:07:32 -0600 |
commit | 9a75f0010f9bc448dfedb5de6e484719613d6428 (patch) | |
tree | 8cf5d48dac797e2d418418b1bb0f3e053f87e5fd | |
parent | damage: remove output_damage_view (diff) | |
download | sway-9a75f0010f9bc448dfedb5de6e484719613d6428.tar.gz sway-9a75f0010f9bc448dfedb5de6e484719613d6428.tar.zst sway-9a75f0010f9bc448dfedb5de6e484719613d6428.zip |
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
-rw-r--r-- | sway/tree/arrange.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index da372aa4..438a2133 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c | |||
@@ -99,7 +99,7 @@ static void apply_tabbed_layout(list_t *children, struct wlr_box *parent) { | |||
99 | } | 99 | } |
100 | for (int i = 0; i < children->length; ++i) { | 100 | for (int i = 0; i < children->length; ++i) { |
101 | 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(); | 102 | int parent_offset = child->view ? 0 : container_titlebar_height(); |
103 | container_remove_gaps(child); | 103 | container_remove_gaps(child); |
104 | child->x = parent->x; | 104 | child->x = parent->x; |
105 | child->y = parent->y + parent_offset; | 105 | child->y = parent->y + parent_offset; |
@@ -115,7 +115,7 @@ static void apply_stacked_layout(list_t *children, struct wlr_box *parent) { | |||
115 | } | 115 | } |
116 | for (int i = 0; i < children->length; ++i) { | 116 | for (int i = 0; i < children->length; ++i) { |
117 | struct sway_container *child = children->items[i]; | 117 | struct sway_container *child = children->items[i]; |
118 | size_t parent_offset = child->view ? 0 : | 118 | int parent_offset = child->view ? 0 : |
119 | container_titlebar_height() * children->length; | 119 | container_titlebar_height() * children->length; |
120 | container_remove_gaps(child); | 120 | container_remove_gaps(child); |
121 | child->x = parent->x; | 121 | child->x = parent->x; |