From: Michael Stapelberg Date: Sun, 7 Aug 2011 13:46:24 +0000 (+0200) Subject: Bugfix: the up/down directions were swapped X-Git-Tag: 4.0.2~52^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=99ba193ce76b020f22fd17858f4fecdc1e75ef58;p=i3%2Fi3 Bugfix: the up/down directions were swapped Also compare 'output' and 'current' in the same order in both parts of the condition to make the comparison more clear. --- diff --git a/src/randr.c b/src/randr.c index bd887630..aa2ea351 100644 --- a/src/randr.c +++ b/src/randr.c @@ -164,19 +164,23 @@ Output *get_output_next(direction_t direction, Output *current) { switch (direction) { case D_UP: - if (current->rect.y < output->rect.y && (!candidate || output->rect.y < candidate->rect.y)) + if (output->rect.y < current->rect.y && + (!candidate || output->rect.y < candidate->rect.y)) candidate = output; break; case D_DOWN: - if (current->rect.y > output->rect.y && (!candidate || output->rect.y > candidate->rect.y)) + if (output->rect.y > current->rect.y && + (!candidate || output->rect.y > candidate->rect.y)) candidate = output; break; case D_LEFT: - if (current->rect.x > output->rect.x && (!candidate || output->rect.x > candidate->rect.x)) + if (output->rect.x < current->rect.x && + (!candidate || output->rect.x > candidate->rect.x)) candidate = output; break; case D_RIGHT: - if (current->rect.x < output->rect.x && (!candidate || output->rect.x < candidate->rect.x)) + if (output->rect.x > current->rect.x && + (!candidate || output->rect.x < candidate->rect.x)) candidate = output; break; } diff --git a/src/tree.c b/src/tree.c index c76a47ee..55bf27d8 100644 --- a/src/tree.c +++ b/src/tree.c @@ -393,9 +393,9 @@ static bool _tree_next(Con *con, char way, orientation_t orientation, bool wrap) else if (way == 'p' && orientation == HORIZ) direction = D_LEFT; else if (way == 'n' && orientation == VERT) - direction = D_UP; - else if (way == 'p' && orientation == VERT) direction = D_DOWN; + else if (way == 'p' && orientation == VERT) + direction = D_UP; else return false;