client.content: Use correct client size (FS#1150)

The size saved in c->geometry also includes the titlebars. Thus, for getting the
window content, we have to subtract this from the size.

Before this, the call to xcb_image_get() was failing with a BadMatch error,
because we were asking for an area that is outside of the actual client's
window's geometry.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2013-09-16 12:06:10 +02:00
parent bb304c80a3
commit 11bef0795a
1 changed files with 8 additions and 3 deletions

View File

@ -1789,11 +1789,16 @@ LUA_OBJECT_EXPORT_PROPERTY(client, client_t, maximized_vertical, lua_pushboolean
static int static int
luaA_client_get_content(lua_State *L, client_t *c) luaA_client_get_content(lua_State *L, client_t *c)
{ {
xcb_image_t *ximage = xcb_image_get(globalconf.connection, xcb_image_t *ximage;
int width = c->geometry.width;
int height = c->geometry.height;
width -= c->titlebar[CLIENT_TITLEBAR_LEFT].size + c->titlebar[CLIENT_TITLEBAR_RIGHT].size;
height -= c->titlebar[CLIENT_TITLEBAR_TOP].size + c->titlebar[CLIENT_TITLEBAR_BOTTOM].size;
ximage = xcb_image_get(globalconf.connection,
c->window, c->window,
0, 0, 0, 0,
c->geometry.width, width, height,
c->geometry.height,
~0, XCB_IMAGE_FORMAT_Z_PIXMAP); ~0, XCB_IMAGE_FORMAT_Z_PIXMAP);
cairo_surface_t *surface = NULL; cairo_surface_t *surface = NULL;