aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2020-03-27 10:56:47 +0100
committerFurkan Sahin <furkan-dev@proton.me>2020-03-27 10:56:47 +0100
commitdfa81fd08ce0d28c3c6f64b9fc2d59212642e4b1 (patch)
tree8a7a9701372997a94bfcf1d1f8cac46930ee7644
parentd1223a8f936838c01741a8e248446fee578f9caa (diff)
Fix hit test for floaters that cross outputs
In the case of multiple overlapping floating windows, this commit fixes an issue where the wrong window would be focused in response to a cursor if one of the windows came from a different output (overhanging).
-rw-r--r--sway/tree/container.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index afb0f927..0c40af0a 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -289,7 +289,10 @@ static struct sway_container *container_at_linear(struct sway_node *parent,
static struct sway_container *floating_container_at(double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy) {
- for (int i = 0; i < root->outputs->length; ++i) {
+ // For outputs with floating containers that overhang the output bounds,
+ // those at the end of the output list appear on top of floating
+ // containers from other outputs, so iterate the list in reverse.
+ for (int i = root->outputs->length - 1; i >= 0; --i) {
struct sway_output *output = root->outputs->items[i];
for (int j = 0; j < output->workspaces->length; ++j) {
struct sway_workspace *ws = output->workspaces->items[j];