From eb4a7f725d6cd04df785c0874147017b308b7a86 Mon Sep 17 00:00:00 2001 From: Deiz Date: Sat, 22 Sep 2012 12:05:22 -0400 Subject: [PATCH] In get_output_next(), avoid an off-by-one for adjacent outputs and || mutually-exclusive failure conditions. --- src/randr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/randr.c b/src/randr.c index 97915704..a73a94c9 100644 --- a/src/randr.c +++ b/src/randr.c @@ -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; -- 2.39.5