-
- /* 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);
- /* TODO: refactor this code. we need a function to translate
- * coordinates of child_rect/rect. */
-
- if (event->value_mask & XCB_CONFIG_WINDOW_X) {
- if (mode == MODE_STACK || mode == MODE_TABBED) {
- client->rect.x = event->x - 2;
- } else {
- if (client->titlebar_position == TITLEBAR_OFF && client->borderless)
- client->rect.x = event->x;
- else if (client->titlebar_position == TITLEBAR_OFF && !client->borderless)
- client->rect.x = event->x - 1;
- else client->rect.x = event->x - 2;
- }
- }
- if (event->value_mask & XCB_CONFIG_WINDOW_Y) {
- if (mode == MODE_STACK || mode == MODE_TABBED) {
- client->rect.y = event->y - 2;
- } else {
- if (client->titlebar_position == TITLEBAR_OFF && client->borderless)
- client->rect.y = event->y;
- else if (client->titlebar_position == TITLEBAR_OFF && !client->borderless)
- client->rect.y = event->y - 1;
- else client->rect.y = event->y - font->height - 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;
- }
- }
-
- DLOG("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);
-
- /* Push the new position/size to X11 */
- reposition_client(conn, client);
- resize_client(conn, client);
- xcb_flush(conn);
-
- return 1;
+ con = con->parent;
+ DLOG("Container is a floating leaf node, will do that.\n");
+ if (event->value_mask & XCB_CONFIG_WINDOW_X) {
+ con->rect.x = event->x + (-1) * bsr.x;
+ DLOG("proposed x = %d, new x is %d\n", event->x, con->rect.x);
+ }
+ if (event->value_mask & XCB_CONFIG_WINDOW_Y) {
+ con->rect.y = event->y + (-1) * bsr.y;
+ DLOG("proposed y = %d, new y is %d\n", event->y, con->rect.y);
+ }
+ if (event->value_mask & XCB_CONFIG_WINDOW_WIDTH) {
+ con->rect.width = event->width + (-1) * bsr.width;
+ DLOG("proposed width = %d, new width is %d\n", event->width, con->rect.width);
+ }
+ if (event->value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
+ con->rect.height = event->height + (-1) * bsr.height;
+ DLOG("proposed height = %d, new height is %d\n", event->height, con->rect.height);