key: add .keysym to return keysym name

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-04-30 00:11:13 +02:00
parent 7010ffd164
commit c378343a64
2 changed files with 10 additions and 1 deletions

View File

@ -49,6 +49,7 @@ instance
key
key_press
key_release
keysym
leader_id
left
len

10
key.c
View File

@ -20,7 +20,7 @@
*
*/
/* XStringToKeysym() */
/* XStringToKeysym() and XKeysymToString */
#include <X11/Xlib.h>
/* XCB doesn't provide keysyms definition */
@ -1135,6 +1135,8 @@ luaA_setmodifiers(lua_State *L, int ud, uint16_t *mod)
* \return The number of elements pushed on stack.
* \luastack
* \lfield key The key to press to triggers an event.
* \lfield 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'.
* \lfield 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.
@ -1169,6 +1171,12 @@ luaA_key_index(lua_State *L)
lua_pushstring(L, buf);
}
break;
case A_TK_KEYSYM:
if(k->keysym)
lua_pushstring(L, XKeysymToString(k->keysym));
else
return 0;
break;
case A_TK_MODIFIERS:
luaA_pushmodifiers(L, k->mod);
break;