]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Resize client after updating base_height/base_width (Thanks Merovius)
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 23 Nov 2009 08:42:38 +0000 (09:42 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 23 Nov 2009 08:43:22 +0000 (09:43 +0100)
This fixes the problem that urxvt/xterm "lost" a line of space before
being resized the first time.

src/handlers.c
src/layout.c

index cc6066b5257ea1a92d44d2c475c7dadaa93e6f12..feacd16b55b512696d689c485d48aa0b092bd82c 100644 (file)
@@ -887,8 +887,13 @@ int handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_w
                 base_height = size_hints.min_height;
         }
 
-        client->base_width = base_width;
-        client->base_height = base_height;
+        if (base_width != client->base_width ||
+            base_height != client->base_height) {
+                client->base_width = base_width;
+                client->base_height = base_height;
+                LOG("client's base_height changed to %d\n", base_height);
+                resize_client(conn, client);
+        }
 
         /* If no aspect ratio was set or if it was invalid, we ignore the hints */
         if (!(size_hints.flags & XCB_SIZE_HINT_P_ASPECT) ||
index f186bbae8c4b5a2737eb4950d1a45a4c1653b28e..164f6875f1617d59e92b1dc39c94945143380355 100644 (file)
@@ -329,15 +329,15 @@ void resize_client(xcb_connection_t *conn, Client *client) {
         if (client->height_increment > 1) {
                 int old_height = rect->height;
                 rect->height -= (rect->height - client->base_height) % client->height_increment;
-                LOG("Lost %d pixel due to client's height_increment (%d px)\n",
-                    old_height - rect->height, client->height_increment);
+                LOG("Lost %d pixel due to client's height_increment (%d px, base_height = %d)\n",
+                    old_height - rect->height, client->height_increment, client->base_height);
         }
 
         if (client->width_increment > 1) {
                 int old_width = rect->width;
                 rect->width -= (rect->width - client->base_width) % client->width_increment;
-                LOG("Lost %d pixel due to client's width_increment (%d px)\n",
-                    old_width - rect->width, client->width_increment);
+                LOG("Lost %d pixel due to client's width_increment (%d px, base_width = %d)\n",
+                    old_width - rect->width, client->width_increment, client->base_width);
         }
 
         LOG("child will be at %dx%d with size %dx%d\n", rect->x, rect->y, rect->width, rect->height);