Send correct geometry in ConfigureNotifies

The code was sending out ConfigureNotify events which contained the size of the
frame window. Thus, the client assumed that it is was larger than it actually
was.

Fix this by subtracting the size of the titlebars from the geometry for the
event.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2012-10-29 10:20:03 +01:00
parent a526e0a559
commit 10d48e1fc8
3 changed files with 22 additions and 5 deletions

View File

@ -337,7 +337,7 @@ event_handle_configurerequest(xcb_configure_request_event_t *ev)
if(!client_resize(c, geometry))
/* ICCCM 4.1.5 / 4.2.3, if nothing was changed, send an event saying so */
xwindow_configure(c->window, geometry, c->border_width);
client_send_configure(c);
}
else
event_handle_configurerequest_configure_window(ev);

View File

@ -584,6 +584,22 @@ HANDLE_GEOM(height)
lua_pop(globalconf.L, 1);
}
/** Send a synthetic configure event to a window.
*/
void
client_send_configure(client_t *c)
{
area_t geometry = c->geometry;
geometry.x += c->titlebar[CLIENT_TITLEBAR_LEFT].size;
geometry.y += c->titlebar[CLIENT_TITLEBAR_TOP].size;
geometry.width -= c->titlebar[CLIENT_TITLEBAR_LEFT].size;
geometry.width -= c->titlebar[CLIENT_TITLEBAR_RIGHT].size;
geometry.height -= c->titlebar[CLIENT_TITLEBAR_TOP].size;
geometry.height -= c->titlebar[CLIENT_TITLEBAR_BOTTOM].size;
xwindow_configure(c->window, geometry, c->border_width);
}
static void
client_resize_do(client_t *c, area_t geometry)
{
@ -610,16 +626,16 @@ client_resize_do(client_t *c, area_t geometry)
real_geometry.height -= c->titlebar[CLIENT_TITLEBAR_TOP].size;
real_geometry.height -= c->titlebar[CLIENT_TITLEBAR_BOTTOM].size;
xcb_configure_window(globalconf.connection, c->window,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
(uint32_t[]) { real_geometry.x, real_geometry.y, real_geometry.width, real_geometry.height });
xcb_configure_window(globalconf.connection, c->frame_window,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
(uint32_t[]) { geometry.x, geometry.y, geometry.width, geometry.height });
xcb_configure_window(globalconf.connection, c->window,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
(uint32_t[]) { real_geometry.x, real_geometry.y, real_geometry.width, real_geometry.height });
if(send_notice)
/* We are moving without changing the size, see ICCCM 4.2.3 */
xwindow_configure(c->window, geometry, c->border_width);
client_send_configure(c);
client_restore_enterleave_events();

View File

@ -175,6 +175,7 @@ void client_ignore_enterleave_events(void);
void client_restore_enterleave_events(void);
void client_refresh(client_t *);
void client_class_setup(lua_State *);
void client_send_configure(client_t *);
drawable_t *client_get_drawable(client_t *, int, int);
drawable_t *client_get_drawable_offset(client_t *, int *, int *);