From 10d48e1fc88f9e8859a4e3d684c2eac749efe0e1 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Mon, 29 Oct 2012 10:20:03 +0100 Subject: [PATCH] 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 --- event.c | 2 +- objects/client.c | 24 ++++++++++++++++++++---- objects/client.h | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/event.c b/event.c index d2823718b..b60b27857 100644 --- a/event.c +++ b/event.c @@ -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); diff --git a/objects/client.c b/objects/client.c index 1cb62b949..09dff8e71 100644 --- a/objects/client.c +++ b/objects/client.c @@ -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(); diff --git a/objects/client.h b/objects/client.h index 1fac20255..2f24a764d 100644 --- a/objects/client.h +++ b/objects/client.h @@ -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 *);