]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Fix resizing of floating windows in borderless/1-px-border mode (Thanks Grauwolf)
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 18 Nov 2009 21:53:17 +0000 (22:53 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 18 Nov 2009 21:53:17 +0000 (22:53 +0100)
Calculations were wrong (they simply didn’t take into account that
there is more than one border style, the code was from before we
implemented that…). We cannot directly set child_rect to the coordinates
as resize_client takes rect and calculates the child_rect, so we need
the new lines of code for this bugfix in any case (rect needs to be
updated).

src/handlers.c

index af541e6c1fc2f805a564a4befe51a8e3c15cb986..56be49ce5a78f6d2e169beb4c7dd42cf27080cb0 100644 (file)
@@ -342,15 +342,34 @@ int handle_configure_request(void *prophs, xcb_connection_t *conn, xcb_configure
         /* Floating clients can be reconfigured */
         if (client_is_floating(client)) {
                 i3Font *font = load_font(conn, config.font);
+                int mode = (client->container != NULL ? client->container->mode : MODE_DEFAULT);
 
                 if (event->value_mask & XCB_CONFIG_WINDOW_X)
                         client->rect.x = event->x;
                 if (event->value_mask & XCB_CONFIG_WINDOW_Y)
                         client->rect.y = event->y;
-                if (event->value_mask & XCB_CONFIG_WINDOW_WIDTH)
-                        client->rect.width = event->width + 2 + 2;
-                if (event->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
-                        client->rect.height = event->height + (font->height + 2 + 2) + 2;
+                if (event->value_mask & XCB_CONFIG_WINDOW_WIDTH) {
+                        if (mode == MODE_STACK || mode == MODE_TABBED) {
+                                client->rect.width = event->width + 2 + 2;
+                        } else {
+                                if (client->titlebar_position == TITLEBAR_OFF && client->borderless)
+                                        client->rect.width = event->width;
+                                else if (client->titlebar_position == TITLEBAR_OFF && !client->borderless)
+                                        client->rect.width = event->width + (1 + 1);
+                                else client->rect.width = event->width + (2 + 2);
+                        }
+                }
+                if (event->value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
+                        if (mode == MODE_STACK || mode == MODE_TABBED) {
+                                client->rect.height = event->height + 2;
+                        } else {
+                                if (client->titlebar_position == TITLEBAR_OFF && client->borderless)
+                                        client->rect.height = event->height;
+                                else if (client->titlebar_position == TITLEBAR_OFF && !client->borderless)
+                                        client->rect.height = event->height + (1 + 1);
+                                else client->rect.height = event->height + (font->height + 2 + 2) + 2;
+                        }
+                }
 
                 LOG("Accepted new position/size for floating client: (%d, %d) size %d x %d\n",
                     client->rect.x, client->rect.y, client->rect.width, client->rect.height);