mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 18:01:29 +00:00
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
This commit is contained in:
parent
fb4838c943
commit
d57755d05c
|
@ -99,7 +99,7 @@ static void apply_tabbed_layout(list_t *children, struct wlr_box *parent) {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < children->length; ++i) {
|
for (int i = 0; i < children->length; ++i) {
|
||||||
struct sway_container *child = children->items[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);
|
container_remove_gaps(child);
|
||||||
child->x = parent->x;
|
child->x = parent->x;
|
||||||
child->y = parent->y + parent_offset;
|
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) {
|
for (int i = 0; i < children->length; ++i) {
|
||||||
struct sway_container *child = children->items[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_titlebar_height() * children->length;
|
||||||
container_remove_gaps(child);
|
container_remove_gaps(child);
|
||||||
child->x = parent->x;
|
child->x = parent->x;
|
||||||
|
|
Loading…
Reference in a new issue