client: Move the `c:keys()` method to a property.

This commit is contained in:
Emmanuel Lepage Vallee 2018-12-26 21:58:34 -05:00
parent f747438879
commit 296ad18922
3 changed files with 11 additions and 5 deletions

View File

@ -1350,6 +1350,12 @@ object.properties._legacy_accessors(client, "buttons", "_buttons", true, functio
) or false
end, true)
object.properties._legacy_accessors(client, "keys", "_keys", true, function(new_btns)
return new_btns[1] and (
type(new_btns[1]) == "key" or new_btns[1]._is_capi_key
) or false
end, true)
--- Set the client shape.
-- @property shape
-- @tparam gears.shape A gears.shape compatible function.

View File

@ -3677,9 +3677,9 @@ luaA_client_set_shape_input(lua_State *L, client_t *c)
/** Get or set keys bindings for a client.
*
* @param keys_table An array of key bindings objects, or nothing.
* @return A table with all keys.
* @method keys
* @property keys
* @param table
* @see awful.key
*/
static int
luaA_client_keys(lua_State *L)
@ -3813,7 +3813,7 @@ client_class_setup(lua_State *L)
{
LUA_OBJECT_META(client)
LUA_CLASS_META
{ "keys", luaA_client_keys },
{ "_keys", luaA_client_keys },
{ "isvisible", luaA_client_isvisible },
{ "geometry", luaA_client_geometry },
{ "apply_size_hints", luaA_client_apply_size_hints },

View File

@ -1,6 +1,6 @@
local gobject = require("gears.object")
local gtable = require("gears.table")
return setmetatable({}, {__call = function(_, args)
return setmetatable({_is_capi_key = true}, {__call = function(_, args)
return gtable.crush(gobject(), args)
end})