From 4ef5e816ec86f6779c9d4f08e8e281fdfa4f1e15 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 7 Oct 2009 14:24:39 +0200 Subject: [PATCH] client: remove internal geometry Signed-off-by: Julien Danjou --- event.c | 15 +-------------- objects/client.c | 41 ++++++++++------------------------------- objects/client.h | 2 -- 3 files changed, 11 insertions(+), 47 deletions(-) diff --git a/event.c b/event.c index bcaea27e9..6063d9f2d 100644 --- a/event.c +++ b/event.c @@ -262,7 +262,7 @@ event_handle_configurerequest(void *data __attribute__ ((unused)), if((c = client_getbywin(ev->window))) { - area_t geometry = c->geometries.internal; + area_t geometry = c->geometry; if(ev->value_mask & XCB_CONFIG_WINDOW_X) geometry.x = ev->x; @@ -280,21 +280,8 @@ event_handle_configurerequest(void *data __attribute__ ((unused)), lua_pop(globalconf.L, 1); } - /* Clients are not allowed to directly mess with stacking parameters. */ - ev->value_mask &= ~(XCB_CONFIG_WINDOW_SIBLING | - XCB_CONFIG_WINDOW_STACK_MODE); - - /** Configure request are sent with size relative to real (internal) - * window size, i.e. without borders. */ - geometry.width += 2 * c->border_width; - geometry.height += 2 * c->border_width; - if(!client_resize(c, geometry, false)) - { - geometry.width -= 2 * c->border_width; - geometry.height -= 2 * c->border_width; xwindow_configure(c->window, geometry, c->border_width); - } } else event_handle_configurerequest_configure_window(ev); diff --git a/objects/client.c b/objects/client.c index a70a0f1f7..39cdf9fe5 100644 --- a/objects/client.c +++ b/objects/client.c @@ -452,7 +452,6 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, * been set. */ #define HANDLE_GEOM(attr) \ c->geometry.attr = wgeom->attr; \ - c->geometries.internal.attr = wgeom->attr; \ luaA_object_emit_signal(globalconf.L, -1, "property::" #attr, 0); HANDLE_GEOM(x) HANDLE_GEOM(y) @@ -656,39 +655,19 @@ client_resize(client_t *c, area_t geometry, bool hints) if(geometry.y + geometry.height < 0) geometry.y = 0; - area_t geometry_internal = { .x = geometry.x, - .y = geometry.y, - .width = geometry.width - 2 * c->border_width, - .height = geometry.height - 2 * c->border_width }; - if(hints) - geometry_internal = client_geometry_hints(c, geometry_internal); + geometry = client_geometry_hints(c, geometry); - if(geometry_internal.width == 0 || geometry_internal.height == 0) + if(geometry.width == 0 || geometry.height == 0) return false; - /* Also let client hints propagate to the "official" geometry. */ - geometry.x = geometry_internal.x; - geometry.y = geometry_internal.y; - geometry.width = geometry_internal.width + 2 * c->border_width; - geometry.height = geometry_internal.height + 2 * c->border_width; - - if(c->geometries.internal.x != geometry_internal.x - || c->geometries.internal.y != geometry_internal.y - || c->geometries.internal.width != geometry_internal.width - || c->geometries.internal.height != geometry_internal.height) + if(c->geometry.x != geometry.x + || c->geometry.y != geometry.y + || c->geometry.width != geometry.width + || c->geometry.height != geometry.height) { screen_t *new_screen = screen_getbycoord(c->screen, - geometry_internal.x, geometry_internal.y); - - /* Values to configure a window is an array where values are - * stored according to 'value_mask' */ - uint32_t values[4]; - - c->geometries.internal.x = values[0] = geometry_internal.x; - c->geometries.internal.y = values[1] = geometry_internal.y; - c->geometries.internal.width = values[2] = geometry_internal.width; - c->geometries.internal.height = values[3] = geometry_internal.height; + geometry.x, geometry.y); /* Also store geometry including border */ c->geometry = geometry; @@ -699,7 +678,7 @@ client_resize(client_t *c, area_t geometry, bool hints) xcb_configure_window(globalconf.connection, c->window, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, - values); + (uint32_t[]) { geometry.x, geometry.y, geometry.width, geometry.height }); client_restore_enterleave_events(); @@ -1490,8 +1469,8 @@ luaA_client_get_content(lua_State *L, client_t *c) xcb_image_t *ximage = xcb_image_get(globalconf.connection, c->window, 0, 0, - c->geometries.internal.width, - c->geometries.internal.height, + c->geometry.width, + c->geometry.height, ~0, XCB_IMAGE_FORMAT_Z_PIXMAP); int retval = 0; diff --git a/objects/client.h b/objects/client.h index 6761fadec..803eb947a 100644 --- a/objects/client.h +++ b/objects/client.h @@ -76,8 +76,6 @@ struct client_t area_t fullscreen; /** Client geometry when (un)-max */ area_t max; - /** Internal geometry (matching X11 protocol) */ - area_t internal; } geometries; /** Pre-fullscreen border width */ int border_width_fs;