Bugfix: When toggling floating, the copied size is the client’s size, not the total size

This commit is contained in:
Michael Stapelberg 2009-06-12 22:55:56 +02:00
parent b13a43159f
commit cb12e205d9
1 changed files with 7 additions and 2 deletions

View File

@ -18,6 +18,7 @@
#include <xcb/xcb_event.h> #include <xcb/xcb_event.h>
#include "i3.h" #include "i3.h"
#include "config.h"
#include "data.h" #include "data.h"
#include "util.h" #include "util.h"
#include "xcb.h" #include "xcb.h"
@ -45,6 +46,7 @@ static void drag_pointer(xcb_connection_t *conn, Client *client, xcb_button_pres
*/ */
void toggle_floating_mode(xcb_connection_t *conn, Client *client, bool automatic) { void toggle_floating_mode(xcb_connection_t *conn, Client *client, bool automatic) {
Container *con = client->container; Container *con = client->container;
i3Font *font = load_font(conn, config.font);
if (con == NULL) { if (con == NULL) {
LOG("This client is already in floating (container == NULL), re-inserting\n"); LOG("This client is already in floating (container == NULL), re-inserting\n");
@ -103,8 +105,11 @@ void toggle_floating_mode(xcb_connection_t *conn, Client *client, bool automatic
client->floating_rect.y = client->rect.y; client->floating_rect.y = client->rect.y;
/* Copy the size the other direction */ /* Copy the size the other direction */
client->rect.width = client->floating_rect.width; client->child_rect.width = client->floating_rect.width;
client->rect.height = client->floating_rect.height; client->child_rect.height = client->floating_rect.height;
client->rect.width = client->child_rect.width + 2 + 2;
client->rect.height = client->child_rect.height + (font->height + 2 + 2) + 2;
LOG("copying size from tiling (%d, %d) size (%d, %d)\n", client->floating_rect.x, client->floating_rect.y, LOG("copying size from tiling (%d, %d) size (%d, %d)\n", client->floating_rect.x, client->floating_rect.y,
client->floating_rect.width, client->floating_rect.height); client->floating_rect.width, client->floating_rect.height);