event: do not store resize events of banned clients

This should fix the problem seen with Firefox. When clicking on a
file that will launch a "Save as" dialog, and switching tag quickly,
the client is banned and move off of the viewport.
Then FF send a ConfigureRequest to re-move it to this negative
coordinates, which we did handle and set as its geometries.
Now we just honor the (bad and useless) move but we do not use
client_resize()

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-01-30 15:20:04 +01:00
parent b878e1491f
commit f45cdee4eb
1 changed files with 66 additions and 50 deletions

116
event.c
View File

@ -220,6 +220,52 @@ event_handle_button(void *data, xcb_connection_t *connection, xcb_button_press_e
return 0;
}
static void
event_handle_configurerequest_configure_window(xcb_configure_request_event_t *ev)
{
uint16_t config_win_mask = 0;
uint32_t config_win_vals[7];
unsigned short i = 0;
if(ev->value_mask & XCB_CONFIG_WINDOW_X)
{
config_win_mask |= XCB_CONFIG_WINDOW_X;
config_win_vals[i++] = ev->x;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_Y)
{
config_win_mask |= XCB_CONFIG_WINDOW_Y;
config_win_vals[i++] = ev->y;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_WIDTH)
{
config_win_mask |= XCB_CONFIG_WINDOW_WIDTH;
config_win_vals[i++] = ev->width;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
{
config_win_mask |= XCB_CONFIG_WINDOW_HEIGHT;
config_win_vals[i++] = ev->height;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)
{
config_win_mask |= XCB_CONFIG_WINDOW_BORDER_WIDTH;
config_win_vals[i++] = ev->border_width;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_SIBLING)
{
config_win_mask |= XCB_CONFIG_WINDOW_SIBLING;
config_win_vals[i++] = ev->sibling;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_STACK_MODE)
{
config_win_mask |= XCB_CONFIG_WINDOW_STACK_MODE;
config_win_vals[i++] = ev->stack_mode;
}
xcb_configure_window(globalconf.connection, ev->window, config_win_mask, config_win_vals);
}
/** The configure event handler.
* \param data currently unused.
* \param connection The connection to the X server.
@ -249,62 +295,32 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
* window size, i.e. without titlebars and borders. */
geometry = titlebar_geometry_add(c->titlebar, c->border, geometry);
if(geometry.x != c->geometry.x || geometry.y != c->geometry.y
|| geometry.width != c->geometry.width || geometry.height != c->geometry.height)
if(geometry.x != c->geometry.x
|| geometry.y != c->geometry.y
|| geometry.width != c->geometry.width
|| geometry.height != c->geometry.height)
{
client_resize(c, geometry, false);
/* All the wiboxes (may) need to be repositioned. */
if(client_hasstrut(c))
wibox_update_positions();
client_need_arrange(c);
if(c->isbanned)
{
window_configure(c->win, geometry, c->border);
event_handle_configurerequest_configure_window(ev);
}
else
{
client_resize(c, geometry, false);
/* All the wiboxes (may) need to be repositioned. */
if(client_hasstrut(c))
wibox_update_positions();
client_need_arrange(c);
return 0;
}
}
else
window_configure(c->win, geometry, c->border);
}
else
{
uint16_t config_win_mask = 0;
uint32_t config_win_vals[7];
unsigned short i = 0;
if(ev->value_mask & XCB_CONFIG_WINDOW_X)
{
config_win_mask |= XCB_CONFIG_WINDOW_X;
config_win_vals[i++] = ev->x;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_Y)
{
config_win_mask |= XCB_CONFIG_WINDOW_Y;
config_win_vals[i++] = ev->y;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_WIDTH)
{
config_win_mask |= XCB_CONFIG_WINDOW_WIDTH;
config_win_vals[i++] = ev->width;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
{
config_win_mask |= XCB_CONFIG_WINDOW_HEIGHT;
config_win_vals[i++] = ev->height;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)
{
config_win_mask |= XCB_CONFIG_WINDOW_BORDER_WIDTH;
config_win_vals[i++] = ev->border_width;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_SIBLING)
{
config_win_mask |= XCB_CONFIG_WINDOW_SIBLING;
config_win_vals[i++] = ev->sibling;
}
if(ev->value_mask & XCB_CONFIG_WINDOW_STACK_MODE)
{
config_win_mask |= XCB_CONFIG_WINDOW_STACK_MODE;
config_win_vals[i++] = ev->stack_mode;
}
xcb_configure_window(connection, ev->window, config_win_mask, config_win_vals);
}
event_handle_configurerequest_configure_window(ev);
return 0;
}