mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
Add input shape support to clients
I explicitly did not add client_shape_input property since querying the input shape of the client window seems useless to me. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
614d1b0d57
commit
70834848e4
1 changed files with 50 additions and 0 deletions
|
@ -669,6 +669,17 @@
|
|||
* @param surface
|
||||
*/
|
||||
|
||||
/**
|
||||
* The client's input shape as set by awesome as a (native) cairo surface.
|
||||
*
|
||||
* **Signal:**
|
||||
*
|
||||
* * *property::shape\_input*
|
||||
*
|
||||
* @property shape_input
|
||||
* @param surface
|
||||
*/
|
||||
|
||||
/**
|
||||
* The client's bounding shape as set by the program as a (native) cairo surface.
|
||||
*
|
||||
|
@ -3271,6 +3282,41 @@ luaA_client_set_shape_clip(lua_State *L, client_t *c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** Get the client's frame window input shape.
|
||||
* \param L The Lua VM state.
|
||||
* \param client The client object.
|
||||
* \return The number of elements pushed on stack.
|
||||
*/
|
||||
static int
|
||||
luaA_client_get_shape_input(lua_State *L, client_t *c)
|
||||
{
|
||||
cairo_surface_t *surf = xwindow_get_shape(c->frame_window, XCB_SHAPE_SK_INPUT);
|
||||
if (!surf)
|
||||
return 0;
|
||||
/* lua has to make sure to free the ref or we have a leak */
|
||||
lua_pushlightuserdata(L, surf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Set the client's frame window input shape.
|
||||
* \param L The Lua VM state.
|
||||
* \param client The client object.
|
||||
* \return The number of elements pushed on stack.
|
||||
*/
|
||||
static int
|
||||
luaA_client_set_shape_input(lua_State *L, client_t *c)
|
||||
{
|
||||
cairo_surface_t *surf = NULL;
|
||||
if(!lua_isnil(L, -1))
|
||||
surf = (cairo_surface_t *)lua_touserdata(L, -1);
|
||||
xwindow_set_shape(c->frame_window,
|
||||
c->geometry.width + (c->border_width * 2),
|
||||
c->geometry.height + (c->border_width * 2),
|
||||
XCB_SHAPE_SK_INPUT, surf, -c->border_width);
|
||||
luaA_object_emit_signal(L, -3, "property::shape_input", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Get or set keys bindings for a client.
|
||||
*
|
||||
* @param keys_table An array of key bindings objects, or nothing.
|
||||
|
@ -3518,6 +3564,10 @@ client_class_setup(lua_State *L)
|
|||
(lua_class_propfunc_t) luaA_client_set_shape_clip,
|
||||
(lua_class_propfunc_t) luaA_client_get_shape_clip,
|
||||
(lua_class_propfunc_t) luaA_client_set_shape_clip);
|
||||
luaA_class_add_property(&client_class, "shape_input",
|
||||
(lua_class_propfunc_t) luaA_client_set_shape_input,
|
||||
(lua_class_propfunc_t) luaA_client_get_shape_input,
|
||||
(lua_class_propfunc_t) luaA_client_set_shape_input);
|
||||
luaA_class_add_property(&client_class, "startup_id",
|
||||
NULL,
|
||||
(lua_class_propfunc_t) luaA_client_get_startup_id,
|
||||
|
|
Loading…
Reference in a new issue