Browse Source

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

Emmanuel Lepage Vallee 10 months ago
parent
commit
296ad18922
3 changed files with 11 additions and 5 deletions
  1. 6
    0
      lib/awful/client.lua
  2. 4
    4
      objects/client.c
  3. 1
    1
      tests/examples/shims/key.lua

+ 6
- 0
lib/awful/client.lua View File

@@ -1350,6 +1350,12 @@ object.properties._legacy_accessors(client, "buttons", "_buttons", true, functio
1350 1350
     ) or false
1351 1351
 end, true)
1352 1352
 
1353
+object.properties._legacy_accessors(client, "keys", "_keys", true, function(new_btns)
1354
+    return new_btns[1] and (
1355
+        type(new_btns[1]) == "key" or new_btns[1]._is_capi_key
1356
+    ) or false
1357
+end, true)
1358
+
1353 1359
 --- Set the client shape.
1354 1360
 -- @property shape
1355 1361
 -- @tparam gears.shape A gears.shape compatible function.

+ 4
- 4
objects/client.c View File

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

+ 1
- 1
tests/examples/shims/key.lua View File

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

Loading…
Cancel
Save