]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: fix coordinates of scratchpad windows on output changes (Thanks badboy)
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 25 Jan 2013 14:47:43 +0000 (15:47 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 25 Jan 2013 14:47:43 +0000 (15:47 +0100)
Previously, after reconfiguring monitors, scratchpad windows could still
be focused but might be out of bounds for you to see.

fixes #929

src/scratchpad.c

index 7b30909554040360233317dd7f70bdeedb9ff28b..c60b29eb2a6a5d2167add5b74c0e47e98bf4863b 100644 (file)
@@ -218,8 +218,24 @@ void scratchpad_fix_resolution(void) {
             new_height = _lcm(new_height, output->rect.height);
         }
     }
+
+    Rect old_rect = __i3_output->rect;
+
     DLOG("new width = %d, new height = %d\n",
          new_width, new_height);
     __i3_output->rect.width = new_width;
     __i3_output->rect.height = new_height;
+
+    Rect new_rect = __i3_output->rect;
+
+    if (memcmp(&old_rect, &new_rect, sizeof(Rect)) == 0) {
+        DLOG("Scratchpad size unchanged.\n");
+        return;
+    }
+
+    DLOG("Fixing coordinates of scratchpad windows\n");
+    Con *con;
+    TAILQ_FOREACH(con, &(__i3_scratch->floating_head), floating_windows) {
+        floating_fix_coordinates(con, &old_rect, &new_rect);
+    }
 }