key: add fallback when second column unavailable

This allows to translate certain combinaison like Shift+Insert.
Insert exists, but Shift+Insert converts to no symbol, resulting in
XCB_NONE returned.

We return either the k0 alternative, without shift, so we got at least
the 'simple' keysym.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-01-04 17:38:40 +01:00
parent c242657c3b
commit cdbbe39011
1 changed files with 4 additions and 0 deletions

4
key.c
View File

@ -205,6 +205,10 @@ key_getkeysym(xcb_keycode_t detail, uint16_t state)
k1 = xcb_key_symbols_get_keysym(globalconf.keysyms, detail, 1); k1 = xcb_key_symbols_get_keysym(globalconf.keysyms, detail, 1);
} }
/* If the second column does not exists use the first one. */
if(k1 == XCB_NONE)
k1 = k0;
/* The numlock modifier is on and the second KeySym is a keypad /* The numlock modifier is on and the second KeySym is a keypad
* KeySym */ * KeySym */
if((state & globalconf.numlockmask) && xcb_is_keypad_key(k1)) if((state & globalconf.numlockmask) && xcb_is_keypad_key(k1))