summaryrefslogtreecommitdiff
path: root/openbox/translate.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-02 03:10:25 +0000
committerDana Jansens <danakj@orodu.net>2007-05-02 03:10:25 +0000
commita6f52b90551621316a36f7cd7b20ef1d5dca0782 (patch)
tree4e36ca9ab824441be3e1453893ff856924bed898 /openbox/translate.c
parentcb030c6f3a6f464cacd46d970ab28c532df84104 (diff)
better menu keyboard handling.
also, when you hit a keybinding while menus are open, it will close the menus and run the binding.
Diffstat (limited to 'openbox/translate.c')
-rw-r--r--openbox/translate.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/openbox/translate.c b/openbox/translate.c
index 97066519..a7cac557 100644
--- a/openbox/translate.c
+++ b/openbox/translate.c
@@ -149,3 +149,19 @@ const gchar *translate_keycode(guint keycode)
ret = XKeysymToString(sym);
return g_locale_to_utf8(ret, -1, NULL, NULL, NULL);
}
+
+gunichar translate_unichar(guint keycode)
+{
+ gunichar unikey = 0;
+
+ const char *key;
+ if ((key = translate_keycode(keycode)) != NULL &&
+ /* don't accept keys that aren't a single letter, like "space" */
+ key[1] == '\0')
+ {
+ unikey = g_utf8_get_char_validated(key, -1);
+ if (unikey == (gunichar)-1 || unikey == (gunichar)-2 || unikey == 0)
+ unikey = 0;
+ }
+ return unikey;
+}