diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2019-02-08 22:29:35 -0500 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2019-02-08 22:29:35 -0500 |
| commit | d3ea229305a41b334ba75d3b80a6ca2f3d11715f (patch) | |
| tree | a7b42df4d2130842803718811f31f468fe1090c1 | |
| parent | a3653eeaa1234247dcff8deb60e930ac49dfc7bf (diff) | |
container_at_stacked: skip titles when zero pixels
It is possible to make the title bars have a zero pixel height while
stacked, by using a blank font and no padding. This causes a division by
zero when attempting to calculate the child index in
container_at_stacked, which then results in a segfault when attempting
to access the child at that bad index (INT_MIN). This just skips the
check to see if the cursor is over a title bar of a child of a stacked
container when the title bar height is zero since there will be no title
bars.
| -rw-r--r-- | sway/tree/container.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 0ebdc51d..9358dad7 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -251,10 +251,12 @@ static struct sway_container *container_at_stacked(struct sway_node *parent, // Title bars int title_height = container_titlebar_height(); - int child_index = (ly - box.y) / title_height; - if (child_index < children->length) { - struct sway_container *child = children->items[child_index]; - return child; + if (title_height > 0) { + int child_index = (ly - box.y) / title_height; + if (child_index < children->length) { + struct sway_container *child = children->items[child_index]; + return child; + } } // Surfaces |
