In get_output_next(), avoid an off-by-one for adjacent outputs and || mutually-exclusive failure conditions.
This commit is contained in:
parent
11378b7012
commit
eb4a7f725d
|
@ -127,15 +127,15 @@ Output *get_output_next(direction_t direction, Output *current, output_close_far
|
||||||
(direction == D_LEFT && other->x < cur->x)) {
|
(direction == D_LEFT && other->x < cur->x)) {
|
||||||
/* Skip the output when it doesn’t overlap the other one’s y
|
/* Skip the output when it doesn’t overlap the other one’s y
|
||||||
* coordinate at all. */
|
* coordinate at all. */
|
||||||
if ((other->y + other->height) < cur->y &&
|
if ((other->y + other->height) <= cur->y ||
|
||||||
(cur->y + cur->height) < other->y)
|
(cur->y + cur->height) <= other->y)
|
||||||
continue;
|
continue;
|
||||||
} else if ((direction == D_DOWN && other->y > cur->y) ||
|
} else if ((direction == D_DOWN && other->y > cur->y) ||
|
||||||
(direction == D_UP && other->y < cur->y)) {
|
(direction == D_UP && other->y < cur->y)) {
|
||||||
/* Skip the output when it doesn’t overlap the other one’s x
|
/* Skip the output when it doesn’t overlap the other one’s x
|
||||||
* coordinate at all. */
|
* coordinate at all. */
|
||||||
if ((other->x + other->width) < cur->x &&
|
if ((other->x + other->width) <= cur->x ||
|
||||||
(cur->x + cur->width) < other->x)
|
(cur->x + cur->width) <= other->x)
|
||||||
continue;
|
continue;
|
||||||
} else
|
} else
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue