client: store _NET_WM_OPACITY
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
ab361ffe85
commit
71f24097c0
15
client.c
15
client.c
|
@ -552,6 +552,9 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
|||
property_update_wm_window_role(c);
|
||||
property_update_net_wm_pid(c, NULL);
|
||||
|
||||
/* get opacity */
|
||||
c->opacity = window_opacity_get(c->win);
|
||||
|
||||
/* Then check clients hints */
|
||||
ewmh_client_check_hints(c);
|
||||
|
||||
|
@ -1527,12 +1530,18 @@ luaA_client_newindex(lua_State *L)
|
|||
break;
|
||||
case A_TK_OPACITY:
|
||||
if(lua_isnil(L, 3))
|
||||
{
|
||||
window_opacity_set(c->win, -1);
|
||||
c->opacity = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
d = luaL_checknumber(L, 3);
|
||||
if(d >= 0 && d <= 1)
|
||||
{
|
||||
window_opacity_set(c->win, d);
|
||||
c->opacity = d;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case A_TK_STICKY:
|
||||
|
@ -1633,7 +1642,6 @@ luaA_client_index(lua_State *L)
|
|||
size_t len;
|
||||
client_t *c = luaA_client_checkudata(L, 1);
|
||||
const char *buf = luaL_checklstring(L, 2, &len);
|
||||
double d;
|
||||
|
||||
if(luaA_usemetatable(L, 1, 2))
|
||||
return 1;
|
||||
|
@ -1749,10 +1757,7 @@ luaA_client_index(lua_State *L)
|
|||
luaA_object_push_item(L, 1, c->icon);
|
||||
break;
|
||||
case A_TK_OPACITY:
|
||||
if((d = window_opacity_get(c->win)) >= 0)
|
||||
lua_pushnumber(L, d);
|
||||
else
|
||||
return 0;
|
||||
lua_pushnumber(L, c->opacity);
|
||||
break;
|
||||
case A_TK_ONTOP:
|
||||
lua_pushboolean(L, c->isontop);
|
||||
|
|
2
client.h
2
client.h
|
@ -156,6 +156,8 @@ struct client_t
|
|||
uint32_t pid;
|
||||
/** Window it is transient for */
|
||||
client_t *transient_for;
|
||||
/** Window opacity */
|
||||
double opacity;
|
||||
};
|
||||
|
||||
client_t * luaA_client_checkudata(lua_State *, int);
|
||||
|
|
27
property.c
27
property.c
|
@ -557,17 +557,24 @@ property_handle_xrootpmap_id(void *data __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
static int
|
||||
property_handle_opacity(void *data __attribute__ ((unused)),
|
||||
xcb_connection_t *connection,
|
||||
uint8_t state,
|
||||
xcb_window_t window,
|
||||
xcb_atom_t name,
|
||||
xcb_get_property_reply_t *reply)
|
||||
property_handle_net_wm_opacity(void *data __attribute__ ((unused)),
|
||||
xcb_connection_t *connection,
|
||||
uint8_t state,
|
||||
xcb_window_t window,
|
||||
xcb_atom_t name,
|
||||
xcb_get_property_reply_t *reply)
|
||||
{
|
||||
wibox_t *wibox = wibox_getbywin(window);
|
||||
|
||||
if (wibox)
|
||||
if(wibox)
|
||||
wibox->opacity = window_opacity_get_from_reply(reply);
|
||||
else
|
||||
{
|
||||
client_t *c = client_getbywin(window);
|
||||
if(c)
|
||||
c->opacity = window_opacity_get_from_reply(reply);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -613,14 +620,12 @@ void a_xcb_set_property_handlers(void)
|
|||
property_handle_net_wm_icon, NULL);
|
||||
xcb_property_set_handler(&globalconf.prophs, _NET_WM_PID, UINT_MAX,
|
||||
property_handle_net_wm_pid, NULL);
|
||||
xcb_property_set_handler(&globalconf.prophs, _NET_WM_WINDOW_OPACITY, 1,
|
||||
property_handle_net_wm_opacity, NULL);
|
||||
|
||||
/* background change */
|
||||
xcb_property_set_handler(&globalconf.prophs, _XROOTPMAP_ID, 1,
|
||||
property_handle_xrootpmap_id, NULL);
|
||||
|
||||
/* Opacity */
|
||||
xcb_property_set_handler(&globalconf.prophs, _NET_WM_WINDOW_OPACITY, 1,
|
||||
property_handle_opacity, NULL);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
Loading…
Reference in New Issue