diff options
| author | Dana Jansens <danakj@orodu.net> | 2009-12-16 15:39:25 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2009-12-16 15:39:25 -0500 |
| commit | 50d662681160c309ea86268c0d05794b87b75593 (patch) | |
| tree | f8ee31f3becc85527581072f9ab1ee6486f62465 /obt | |
| parent | a93b00a5e93281c7c2c31112f0b6b827d605a19d (diff) | |
| parent | 8ada991d829671ab5e6dd4c5526b6a0238ba6a16 (diff) | |
Merge branch 'backport' into work
Conflicts:
obt/keyboard.c
obt/keyboard.h
openbox/event.c
openbox/menuframe.c
openbox/moveresize.c
openbox/openbox.c
openbox/screen.c
Diffstat (limited to 'obt')
| -rw-r--r-- | obt/keyboard.c | 18 | ||||
| -rw-r--r-- | obt/keyboard.h | 5 |
2 files changed, 15 insertions, 8 deletions
diff --git a/obt/keyboard.c b/obt/keyboard.c index 699fa8ba..264201a6 100644 --- a/obt/keyboard.c +++ b/obt/keyboard.c @@ -185,16 +185,24 @@ static void set_modkey_mask(guchar mask, KeySym sym) /* CapsLock, Shift, and Control are special and hard-coded */ } -KeyCode obt_keyboard_keysym_to_keycode(KeySym sym) +KeyCode* obt_keyboard_keysym_to_keycode(KeySym sym) { - gint i, j; + KeyCode *ret; + gint i, j, n; + + ret = g_new(KeyCode, 1); + n = 0; + ret[n] = 0; /* go through each keycode and look for the keysym */ for (i = min_keycode; i <= max_keycode; ++i) for (j = 0; j < keysyms_per_keycode; ++j) - if (sym == keymap[(i-min_keycode) * keysyms_per_keycode + j]) - return i; - return 0; + if (sym == keymap[(i-min_keycode) * keysyms_per_keycode + j]) { + ret = g_renew(KeyCode, ret, ++n); + ret[n-1] = i; + ret[n] = 0; + } + return ret; } gchar *obt_keyboard_keycode_to_string(guint keycode) diff --git a/obt/keyboard.h b/obt/keyboard.h index dd28cb86..4fb60186 100644 --- a/obt/keyboard.h +++ b/obt/keyboard.h @@ -54,9 +54,8 @@ guint obt_keyboard_only_modmasks(guint mask); right keys when there are both. */ guint obt_keyboard_modkey_to_modmask(ObtModkeysKey key); -/*! Convert a KeySym to a KeyCode, because the X function is terrible - says - valgrind. */ -KeyCode obt_keyboard_keysym_to_keycode(KeySym sym); +/*! Convert a KeySym to all the KeyCodes which generate it. */ +KeyCode* obt_keyboard_keysym_to_keycode(KeySym sym); /*! Give the string form of a KeyCode */ gchar *obt_keyboard_keycode_to_string(guint keycode); |
