Always Obey Configure Requests

If configure requests are not observed for tiled and fullscreen clients,
it might happen that only a part of the window will be used: this is
what happens if you change the font size of an urxvt window on-the-fly.
This commit is contained in:
Bastien Dejean 2012-09-24 12:08:51 +02:00
parent 5ca8e69d02
commit 00ec4018d8
2 changed files with 61 additions and 51 deletions

106
events.c
View file

@ -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)

View file

@ -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 {