summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2019-03-10 15:00:15 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-11 10:56:20 -0400
commitd57755d05cbbcd2af920113e41b96663447ccc80 (patch)
treeb2ae4bcaeec6e02cbf9b9cf347362e09942fab15
parentfb4838c943599b01c54803aab97b3d0d1693db06 (diff)
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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index da372aa44..438a21335 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) {
}
for (int i = 0; i < children->length; ++i) {
struct sway_container *child = children->items[i];
- size_t parent_offset = child->view ? 0 : container_titlebar_height();
+ int parent_offset = child->view ? 0 : container_titlebar_height();
container_remove_gaps(child);
child->x = parent->x;
child->y = parent->y + parent_offset;
@@ -115,7 +115,7 @@ static void apply_stacked_layout(list_t *children, struct wlr_box *parent) {
}
for (int i = 0; i < children->length; ++i) {
struct sway_container *child = children->items[i];
- size_t parent_offset = child->view ? 0 :
+ int parent_offset = child->view ? 0 :
container_titlebar_height() * children->length;
container_remove_gaps(child);
child->x = parent->x;