root.buttons: Move to Lua.

This is the groundwork commit to support using `awful.button` objects in
`root.buttons`.
This commit is contained in:
Emmanuel Lepage Vallee 2018-12-26 15:57:01 -05:00
parent b1c81c4258
commit 141aca2432
3 changed files with 21 additions and 2 deletions

View file

@ -56,3 +56,21 @@ do
root.object = root_object
assert(root.object == root_object)
end
-- root.bottons() used to be a capi function. However this proved confusing
-- as rc.lua used `awful.button` and `root.buttons()` used capi.button. There
-- was a little documented hack to "flatten" awful.button into a pair of
-- capi.button. A consequence of this, beside being ugly, was that it was
-- de-facto read-only due the confusion related the difference between the
-- capi and "high level" format difference.
--- Get or set global mouse bindings.
--
-- This binding will be available when you click on the root window (usually
-- the wallpaper area).
-- @tparam[opt=nil] table|nil The list of `button` objects to set.
-- @treturn table The list of root window buttons.
function root.buttons(btns)
return root._buttons(btns)
end

4
root.c
View file

@ -374,7 +374,7 @@ luaA_root_keys(lua_State *L)
return 1;
}
/** Get or set global mouse bindings.
/* Get or set global mouse bindings.
* This binding will be available when you click on the root window.
*
* @param button_table An array of mouse button bindings objects, or nothing.
@ -587,7 +587,7 @@ luaA_root_newindex(lua_State *L)
const struct luaL_Reg awesome_root_methods[] =
{
{ "buttons", luaA_root_buttons },
{ "_buttons", luaA_root_buttons },
{ "keys", luaA_root_keys },
{ "cursor", luaA_root_cursor },
{ "fake_input", luaA_root_fake_input },

View file

@ -1,5 +1,6 @@
return function() return {
data = {},
_is_capi_button = true,
connect_signal = function() end
} end