]> git.sur5r.net Git - i3/i3/commitdiff
In get_output_next(), avoid an off-by-one for adjacent outputs and || mutually-exclus...
authorDeiz <silverwraithii@gmail.com>
Sat, 22 Sep 2012 16:05:22 +0000 (12:05 -0400)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 22 Sep 2012 16:12:49 +0000 (18:12 +0200)
src/randr.c

index 97915704e855276f41bbb4cf161b248bffe3abbb..a73a94c92450ad9c9052481694aa7f1e6b032f48 100644 (file)
@@ -127,15 +127,15 @@ Output *get_output_next(direction_t direction, Output *current, output_close_far
             (direction == D_LEFT  && other->x < cur->x)) {
             /* Skip the output when it doesn’t overlap the other one’s y
              * coordinate at all. */
-            if ((other->y + other->height) < cur->y &&
-                (cur->y   + cur->height)   < other->y)
+            if ((other->y + other->height) <= cur->y ||
+                (cur->y   + cur->height)   <= other->y)
                 continue;
         } else if ((direction == D_DOWN && other->y > cur->y) ||
                    (direction == D_UP   && other->y < cur->y)) {
             /* Skip the output when it doesn’t overlap the other one’s x
              * coordinate at all. */
-            if ((other->x + other->width) < cur->x &&
-                (cur->x   + cur->width)   < other->x)
+            if ((other->x + other->width) <= cur->x ||
+                (cur->x   + cur->width)   <= other->x)
                 continue;
         } else
             continue;