Client: Add (and use) visualtype member to client_t objects
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
6c4668cb49
commit
ef27189ffe
|
@ -149,7 +149,7 @@ scan(xcb_query_tree_cookie_t tree_c)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
client_manage(wins[i], geom_r, true);
|
client_manage(wins[i], geom_r, attr_r, true);
|
||||||
|
|
||||||
p_delete(&attr_r);
|
p_delete(&attr_r);
|
||||||
p_delete(&geom_r);
|
p_delete(&geom_r);
|
||||||
|
|
2
event.c
2
event.c
|
@ -632,7 +632,7 @@ event_handle_maprequest(xcb_map_request_event_t *ev)
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
|
|
||||||
client_manage(ev->window, geom_r, false);
|
client_manage(ev->window, geom_r, wa_r, false);
|
||||||
|
|
||||||
p_delete(&geom_r);
|
p_delete(&geom_r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,7 +421,7 @@ client_update_properties(client_t *c)
|
||||||
* \param startup True if we are managing at startup time.
|
* \param startup True if we are managing at startup time.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, bool startup)
|
client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, xcb_get_window_attributes_reply_t *wattr, bool startup)
|
||||||
{
|
{
|
||||||
const uint32_t select_input_val[] = { CLIENT_SELECT_INPUT_EVENT_MASK };
|
const uint32_t select_input_val[] = { CLIENT_SELECT_INPUT_EVENT_MASK };
|
||||||
|
|
||||||
|
@ -448,8 +448,9 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, bool startup)
|
||||||
|
|
||||||
/* consider the window banned */
|
/* consider the window banned */
|
||||||
c->isbanned = true;
|
c->isbanned = true;
|
||||||
/* Store window */
|
/* Store window and visual */
|
||||||
c->window = w;
|
c->window = w;
|
||||||
|
c->visualtype = draw_find_visual(globalconf.screen, wattr->visual);
|
||||||
c->frame_window = xcb_generate_id(globalconf.connection);
|
c->frame_window = xcb_generate_id(globalconf.connection);
|
||||||
xcb_create_window(globalconf.connection, globalconf.default_depth, c->frame_window, s->root,
|
xcb_create_window(globalconf.connection, globalconf.default_depth, c->frame_window, s->root,
|
||||||
wgeom->x, wgeom->y, wgeom->width, wgeom->height,
|
wgeom->x, wgeom->y, wgeom->width, wgeom->height,
|
||||||
|
@ -1830,8 +1831,6 @@ luaA_client_get_maximized(lua_State *L, client_t *c)
|
||||||
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_get_window_attributes_cookie_t cookie;
|
|
||||||
xcb_get_window_attributes_reply_t *attr;
|
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
int width = c->geometry.width;
|
int width = c->geometry.width;
|
||||||
int height = c->geometry.height;
|
int height = c->geometry.height;
|
||||||
|
@ -1840,19 +1839,11 @@ luaA_client_get_content(lua_State *L, client_t *c)
|
||||||
width -= c->titlebar[CLIENT_TITLEBAR_LEFT].size + c->titlebar[CLIENT_TITLEBAR_RIGHT].size;
|
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;
|
height -= c->titlebar[CLIENT_TITLEBAR_TOP].size + c->titlebar[CLIENT_TITLEBAR_BOTTOM].size;
|
||||||
|
|
||||||
cookie = xcb_get_window_attributes(globalconf.connection, c->window);
|
|
||||||
attr = xcb_get_window_attributes_reply(globalconf.connection, cookie, NULL);
|
|
||||||
|
|
||||||
if (!attr)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
surface = cairo_xcb_surface_create(globalconf.connection, c->window,
|
surface = cairo_xcb_surface_create(globalconf.connection, c->window,
|
||||||
draw_find_visual(globalconf.screen, attr->visual),
|
c->visualtype, width, height);
|
||||||
width, height);
|
|
||||||
|
|
||||||
/* lua has to make sure to free the ref or we have a leak */
|
/* lua has to make sure to free the ref or we have a leak */
|
||||||
lua_pushlightuserdata(L, surface);
|
lua_pushlightuserdata(L, surface);
|
||||||
free(attr);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,9 @@ struct client_t
|
||||||
cairo_surface_t *icon;
|
cairo_surface_t *icon;
|
||||||
/** Size hints */
|
/** Size hints */
|
||||||
xcb_size_hints_t size_hints;
|
xcb_size_hints_t size_hints;
|
||||||
|
/** The visualtype that c->window uses */
|
||||||
|
xcb_visualtype_t *visualtype;
|
||||||
|
/** Do we honor the client's size hints? */
|
||||||
bool size_hints_honor;
|
bool size_hints_honor;
|
||||||
/** Machine the client is running on. */
|
/** Machine the client is running on. */
|
||||||
char *machine;
|
char *machine;
|
||||||
|
@ -140,7 +143,7 @@ client_t * client_getbyframewin(xcb_window_t);
|
||||||
void client_ban(client_t *);
|
void client_ban(client_t *);
|
||||||
void client_ban_unfocus(client_t *);
|
void client_ban_unfocus(client_t *);
|
||||||
void client_unban(client_t *);
|
void client_unban(client_t *);
|
||||||
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, bool);
|
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, xcb_get_window_attributes_reply_t *, bool);
|
||||||
bool client_resize(client_t *, area_t, bool);
|
bool client_resize(client_t *, area_t, bool);
|
||||||
void client_unmanage(client_t *, bool);
|
void client_unmanage(client_t *, bool);
|
||||||
void client_kill(client_t *);
|
void client_kill(client_t *);
|
||||||
|
|
Loading…
Reference in New Issue