]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: the up/down directions were swapped
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 7 Aug 2011 13:46:24 +0000 (15:46 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 7 Aug 2011 13:46:24 +0000 (15:46 +0200)
Also compare 'output' and 'current' in the same order in both parts of the
condition to make the comparison more clear.

src/randr.c
src/tree.c

index bd887630e5c124d6f31b055060ca8f49d7a7a46c..aa2ea351dcd8997af9b87c672d54dd2a88f29df7 100644 (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;
         }
index c76a47eeee23fb0c98893c5697a2187bcc5ef6fd..55bf27d831a0abf45726db1f1c234edac38d944a 100644 (file)
@@ -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;