doc: improve doc for key.key and awful.key

This commit is contained in:
Daniel Hahler 2015-06-19 20:49:53 +02:00
parent 3fe663fc60
commit c2ee98b69c
2 changed files with 25 additions and 19 deletions

View File

@ -6,33 +6,34 @@
--- Key object.
--
-- @field key The key to press to triggers an event.
-- @field keysym Same as key, but return the name of the key symbol. It can
-- be identical to key, but for characters like '.' it will return 'period'.
-- @field modifiers The modifier key that should be pressed while the key is
-- pressed. An array with all the modifiers. Valid modifiers are: Any, Mod1,
-- Mod2, Mod3, Mod4, Mod5, Shift, Lock and Control.
-- @tfield string key The key to trigger an event.
-- @tfield string keysym Same as key, but return the name of the key symbol. It
-- can be identical to key, but for characters like '.' it will return
-- 'period'.
-- @tfield table modifiers The modifier key that should be pressed while the
-- key is pressed. An array with all the modifiers. Valid modifiers are: Any,
-- Mod1, Mod2, Mod3, Mod4, Mod5, Shift, Lock and Control.
-- @table key
--- Add a signal.
--
-- @param name A signal name.
-- @param func A function to call when the signal is emitted.
-- @tparam string name A signal name.
-- @tparam function func A function to call when the signal is emitted.
-- @function connect_signal
--- Remove a signal.
--
-- @param name A signal name.
-- @param func A function to remove.
-- @tparam string name A signal name.
-- @tparam function func A function to remove.
-- @function disconnect_signal
--- Emit a signal.
--
-- @param name A signal name.
-- @tparam string name A signal name.
-- @param[opt] ... Various arguments.
-- @function emit_signal
--- Get the number of instances.
--
-- @return The number of key objects alive.
-- @treturn number The number of key objects alive.
-- @function instances

View File

@ -25,14 +25,19 @@ local ignore_modifiers = { "Lock", "Mod2" }
--- Create a new key to use as binding.
-- This function is useful to create several keys from one, because it will use
-- the ignore_modifier variable to create more key with or without the ignored
-- modifiers activated.
-- the ignore_modifier variable to create several keys with and without the
-- ignored modifiers activated.
-- For example if you want to ignore CapsLock in your keybinding (which is
-- ignored by default by this function), creating key binding with this function
-- will return 2 key objects: one with CapsLock on, and the other one with
-- CapsLock off.
-- @see key
-- @return A table with one or several key objects.
-- ignored by default by this function), creating a key binding with this
-- function will return 2 key objects: one with CapsLock on, and another one
-- with CapsLock off.
-- @see key.key
-- @tparam table mod A list of modifier keys. Valid modifiers are: Any, Mod1,
-- Mod2, Mod3, Mod4, Mod5, Shift, Lock and Control.
-- @tparam string _key The key to trigger an event.
-- @tparam function press Callback for when the key is pressed.
-- @tparam function release Callback for when the key is released.
-- @treturn table A table with one or several key objects.
function key.new(mod, _key, press, release)
local ret = {}
local subsets = util.subsets(ignore_modifiers)