diff --git a/luaa.c b/luaa.c index f0e98baa..f01ca6ed 100644 --- a/luaa.c +++ b/luaa.c @@ -495,7 +495,9 @@ static int luaA_get_modifiers(lua_State *L) lua_settable(L, -3); lua_pushstring(L, "keysym"); - lua_pushstring(L, XKeysymToString(key_sym)); + char *string = key_get_keysym_name(key_sym); + lua_pushstring(L, string); + p_delete(&string); lua_settable(L, -3); lua_settable(L, -3); diff --git a/objects/key.c b/objects/key.c index 94f73eba..932921ca 100644 --- a/objects/key.c +++ b/objects/key.c @@ -275,8 +275,8 @@ luaA_key_set_modifiers(lua_State *L, keyb_t *k) LUA_OBJECT_EXPORT_PROPERTY(key, keyb_t, modifiers, luaA_pushmodifiers) /* It's caller's responsibility to release the returned string. */ -static char * -get_keysym_name(xkb_keysym_t keysym) +char * +key_get_keysym_name(xkb_keysym_t keysym) { const ssize_t bufsize = 64; char *buf = p_new(char, bufsize); @@ -310,7 +310,7 @@ luaA_key_get_key(lua_State *L, keyb_t *k) } else { - char *name = get_keysym_name(k->keysym); + char *name = key_get_keysym_name(k->keysym); if(!name) return 0; lua_pushstring(L, name); @@ -322,7 +322,7 @@ luaA_key_get_key(lua_State *L, keyb_t *k) static int luaA_key_get_keysym(lua_State *L, keyb_t *k) { - char *name = get_keysym_name(k->keysym); + char *name = key_get_keysym_name(k->keysym); if(!name) return 0; lua_pushstring(L, name); diff --git a/objects/key.h b/objects/key.h index f5427367..8aa07ffe 100644 --- a/objects/key.h +++ b/objects/key.h @@ -23,6 +23,7 @@ #define AWESOME_OBJECTS_KEY_H #include "common/luaobject.h" +#include typedef struct keyb_t { @@ -47,6 +48,8 @@ int luaA_key_array_get(lua_State *, int, key_array_t *); int luaA_pushmodifiers(lua_State *, uint16_t); uint16_t luaA_tomodifiers(lua_State *L, int ud); +char * key_get_keysym_name(xkb_keysym_t keysym); + #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80