diff --git a/events.c b/events.c index c2a0d8b..88a605e 100644 --- a/events.c +++ b/events.c @@ -120,59 +120,65 @@ void configure_request(xcb_generic_event_t *evt) window_location_t loc; bool is_managed = locate_window(e->window, &loc); - if (!is_managed || is_floating(loc.node->client)) { - uint16_t mask = 0; - uint32_t values[7]; - unsigned short i = 0; + uint16_t mask = 0; + uint32_t values[7]; + unsigned short i = 0; - if (e->value_mask & XCB_CONFIG_WINDOW_X) { - mask |= XCB_CONFIG_WINDOW_X; - values[i++] = e->x; - if (is_managed) - loc.node->client->floating_rectangle.x = e->x; - } - - if (e->value_mask & XCB_CONFIG_WINDOW_Y) { - mask |= XCB_CONFIG_WINDOW_Y; - values[i++] = e->y; - if (is_managed) - loc.node->client->floating_rectangle.y = e->y; - } - - if (e->value_mask & XCB_CONFIG_WINDOW_WIDTH) { - mask |= XCB_CONFIG_WINDOW_WIDTH; - values[i++] = e->width; - if (is_managed) - loc.node->client->floating_rectangle.width = e->width; - } - - if (e->value_mask & XCB_CONFIG_WINDOW_HEIGHT) { - mask |= XCB_CONFIG_WINDOW_HEIGHT; - values[i++] = e->height; - if (is_managed) - loc.node->client->floating_rectangle.height = e->height; - } - - if (!is_managed && e->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) { - mask |= XCB_CONFIG_WINDOW_BORDER_WIDTH; - values[i++] = e->border_width; - } - - if (e->value_mask & XCB_CONFIG_WINDOW_SIBLING) { - mask |= XCB_CONFIG_WINDOW_SIBLING; - values[i++] = e->sibling; - } - - if (e->value_mask & XCB_CONFIG_WINDOW_STACK_MODE) { - mask |= XCB_CONFIG_WINDOW_STACK_MODE; - values[i++] = e->stack_mode; - } - - xcb_configure_window(dpy, e->window, mask, values); + if (e->value_mask & XCB_CONFIG_WINDOW_X) { + mask |= XCB_CONFIG_WINDOW_X; + values[i++] = e->x; + if (is_managed) + loc.node->client->floating_rectangle.x = e->x; } - if (is_managed && is_floating(loc.node->client)) - apply_layout(loc.desktop, loc.node, root_rect); + if (e->value_mask & XCB_CONFIG_WINDOW_Y) { + mask |= XCB_CONFIG_WINDOW_Y; + values[i++] = e->y; + if (is_managed) + loc.node->client->floating_rectangle.y = e->y; + } + + if (e->value_mask & XCB_CONFIG_WINDOW_WIDTH) { + mask |= XCB_CONFIG_WINDOW_WIDTH; + values[i++] = e->width; + if (is_managed) + loc.node->client->floating_rectangle.width = e->width; + } + + if (e->value_mask & XCB_CONFIG_WINDOW_HEIGHT) { + mask |= XCB_CONFIG_WINDOW_HEIGHT; + values[i++] = e->height; + if (is_managed) + loc.node->client->floating_rectangle.height = e->height; + } + + if (!is_managed && e->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) { + mask |= XCB_CONFIG_WINDOW_BORDER_WIDTH; + values[i++] = e->border_width; + } + + if (e->value_mask & XCB_CONFIG_WINDOW_SIBLING) { + mask |= XCB_CONFIG_WINDOW_SIBLING; + values[i++] = e->sibling; + } + + if (e->value_mask & XCB_CONFIG_WINDOW_STACK_MODE) { + mask |= XCB_CONFIG_WINDOW_STACK_MODE; + values[i++] = e->stack_mode; + } + + xcb_configure_window(dpy, e->window, mask, values); + + if (is_managed) { + if (loc.node->client->fullscreen) + window_move_resize(e->window, 0, 0, screen_width, screen_height); + else if (is_tiled(loc.node->client)) { + xcb_rectangle_t rect = loc.node->client->tiled_rectangle; + window_move_resize(e->window, rect.x, rect.y, rect.width, rect.height); + } else { + window_draw_border(loc.node, (loc.node == loc.desktop->focus)); + } + } } void destroy_notify(xcb_generic_event_t *evt) diff --git a/window.c b/window.c index b72e7d4..bd7cb6b 100644 --- a/window.c +++ b/window.c @@ -173,7 +173,11 @@ void toggle_fullscreen(client_t *c) c->fullscreen = false; xcb_atom_t values[] = {XCB_NONE}; xcb_ewmh_set_wm_state(ewmh, c->window, LENGTH(values), values); - xcb_rectangle_t rect = c->floating_rectangle; + xcb_rectangle_t rect; + if (is_floating(c)) + rect = c->floating_rectangle; + else + rect = c->tiled_rectangle; window_border_width(c->window, border_width); window_move_resize(c->window, rect.x, rect.y, rect.width, rect.height); } else {