client: remove internal geometry

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-10-07 14:24:39 +02:00
parent c94f7b6767
commit 4ef5e816ec
3 changed files with 11 additions and 47 deletions

15
event.c
View File

@ -262,7 +262,7 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
if((c = client_getbywin(ev->window))) 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) if(ev->value_mask & XCB_CONFIG_WINDOW_X)
geometry.x = ev->x; geometry.x = ev->x;
@ -280,21 +280,8 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
lua_pop(globalconf.L, 1); 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)) 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); xwindow_configure(c->window, geometry, c->border_width);
}
} }
else else
event_handle_configurerequest_configure_window(ev); event_handle_configurerequest_configure_window(ev);

View File

@ -452,7 +452,6 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
* been set. */ * been set. */
#define HANDLE_GEOM(attr) \ #define HANDLE_GEOM(attr) \
c->geometry.attr = wgeom->attr; \ c->geometry.attr = wgeom->attr; \
c->geometries.internal.attr = wgeom->attr; \
luaA_object_emit_signal(globalconf.L, -1, "property::" #attr, 0); luaA_object_emit_signal(globalconf.L, -1, "property::" #attr, 0);
HANDLE_GEOM(x) HANDLE_GEOM(x)
HANDLE_GEOM(y) HANDLE_GEOM(y)
@ -656,39 +655,19 @@ client_resize(client_t *c, area_t geometry, bool hints)
if(geometry.y + geometry.height < 0) if(geometry.y + geometry.height < 0)
geometry.y = 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) 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; return false;
/* Also let client hints propagate to the "official" geometry. */ if(c->geometry.x != geometry.x
geometry.x = geometry_internal.x; || c->geometry.y != geometry.y
geometry.y = geometry_internal.y; || c->geometry.width != geometry.width
geometry.width = geometry_internal.width + 2 * c->border_width; || c->geometry.height != geometry.height)
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)
{ {
screen_t *new_screen = screen_getbycoord(c->screen, screen_t *new_screen = screen_getbycoord(c->screen,
geometry_internal.x, geometry_internal.y); geometry.x, geometry.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;
/* Also store geometry including border */ /* Also store geometry including border */
c->geometry = geometry; 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_configure_window(globalconf.connection, c->window,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
| XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
values); (uint32_t[]) { geometry.x, geometry.y, geometry.width, geometry.height });
client_restore_enterleave_events(); 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, xcb_image_t *ximage = xcb_image_get(globalconf.connection,
c->window, c->window,
0, 0, 0, 0,
c->geometries.internal.width, c->geometry.width,
c->geometries.internal.height, c->geometry.height,
~0, XCB_IMAGE_FORMAT_Z_PIXMAP); ~0, XCB_IMAGE_FORMAT_Z_PIXMAP);
int retval = 0; int retval = 0;

View File

@ -76,8 +76,6 @@ struct client_t
area_t fullscreen; area_t fullscreen;
/** Client geometry when (un)-max */ /** Client geometry when (un)-max */
area_t max; area_t max;
/** Internal geometry (matching X11 protocol) */
area_t internal;
} geometries; } geometries;
/** Pre-fullscreen border width */ /** Pre-fullscreen border width */
int border_width_fs; int border_width_fs;