- DLOG("destination container = %p\n", con);
- Client *old_focused = con->currently_focused;
- /* Preserve position/size */
- memcpy(&(client->floating_rect), &(client->rect), sizeof(Rect));
-
- client->floating = FLOATING_USER_OFF;
- client->container = con;
-
- if (old_focused != NULL && !old_focused->dock)
- CIRCLEQ_INSERT_AFTER(&(con->clients), old_focused, client, clients);
- else CIRCLEQ_INSERT_TAIL(&(con->clients), client, clients);
-
- DLOG("Re-inserted the window.\n");
- con->currently_focused = client;
-
- client_set_below_floating(conn, client);
-
- render_container(conn, con);
- xcb_flush(conn);
-
- return;
- }
-
- DLOG("Entering floating for client %08x\n", client->child);
-
- /* Remove the client of its container */
- client_remove_from_container(conn, client, con, false);
- client->container = NULL;
-
- /* Add the client to the list of floating clients for its workspace */
- TAILQ_INSERT_TAIL(&(client->workspace->floating_clients), client, floating_clients);
-
- if (con->currently_focused == client) {
- DLOG("Need to re-adjust currently_focused\n");
- /* Get the next client in the focus stack for this particular container */
- con->currently_focused = get_last_focused_client(conn, con, NULL);
- }
-
- if (automatic)
- client->floating = FLOATING_AUTO_ON;
- else client->floating = FLOATING_USER_ON;
-
- /* Initialize the floating position from the position in tiling mode, if this
- * client never was floating (x == -1) */
- if (client->floating_rect.x == -1) {
- /* Copy over the position */
- client->floating_rect.x = client->rect.x;
- client->floating_rect.y = client->rect.y;
-
- /* Copy size the other direction */
- client->child_rect.width = client->floating_rect.width;
- 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;
-
- DLOG("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);
- } else {
- /* If the client was already in floating before we restore the old position / size */
- DLOG("using: (%d, %d) size (%d, %d)\n", client->floating_rect.x, client->floating_rect.y,
- client->floating_rect.width, client->floating_rect.height);
- memcpy(&(client->rect), &(client->floating_rect), sizeof(Rect));
- }
-
- /* Raise the client */
- xcb_raise_window(conn, client->frame);
- reposition_client(conn, client);
- resize_client(conn, client);
- /* redecorate_window flushes */
- redecorate_window(conn, client);