]> git.sur5r.net Git - i3/i3/blobdiff - src/randr.c
Bugfix: handle MapRequests sent between i3 registering as a wm and handling events
[i3/i3] / src / randr.c
index 97915704e855276f41bbb4cf161b248bffe3abbb..267d6e41bf307628c058653325d94100888c7ad4 100644 (file)
@@ -69,7 +69,7 @@ Output *get_first_output(void) {
         if (output->active)
             return output;
 
-    return NULL;
+    die("No usable outputs available.\n");
 }
 
 /*
@@ -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;
@@ -647,8 +647,7 @@ void randr_query_outputs(void) {
             output->active = false;
             DLOG("Output %s disabled, re-assigning workspaces/docks\n", output->name);
 
-            if ((first = get_first_output()) == NULL)
-                die("No usable outputs available\n");
+            first = get_first_output();
 
             /* TODO: refactor the following code into a nice function. maybe
              * use an on_destroy callback which is implement differently for
@@ -736,6 +735,9 @@ void randr_query_outputs(void) {
         disable_randr(conn);
     }
 
+    /* Verifies that there is at least one active output as a side-effect. */
+    get_first_output();
+
     /* Just go through each active output and assign one workspace */
     TAILQ_FOREACH(output, &outputs, outputs) {
         if (!output->active)