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.
This commit is contained in:
Michael Stapelberg
2011-08-07 15:46:24 +02:00
parent 692d65b0fd
commit 99ba193ce7
2 changed files with 10 additions and 6 deletions

View File

@ -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;
}