From bb066becb906ddb6882b57fbedb7158aec3cbf99 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 24 Jul 2012 02:42:58 +0100 Subject: [PATCH weston] Terminal: Handle keypad symbols XKB provides keypad symbols in a separate namespace. We don't care about the distinction, so map them to normal symbols before starting processing. Signed-off-by: Daniel Stone --- clients/terminal.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/clients/terminal.c b/clients/terminal.c index 3cd35b0..d8a0a6a 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -2124,6 +2124,69 @@ key_handler(struct window *window, struct input *input, uint32_t time, handle_bound_key(terminal, input, sym, time)) return; + /* Map keypad symbols to 'normal' equivalents before processing */ + switch (sym) { + case XKB_KEY_KP_Space: + sym = XKB_KEY_space; + break; + case XKB_KEY_KP_Tab: + sym = XKB_KEY_Tab; + break; + case XKB_KEY_KP_Enter: + sym = XKB_KEY_Return; + break; + case XKB_KEY_KP_Left: + sym = XKB_KEY_Left; + break; + case XKB_KEY_KP_Up: + sym = XKB_KEY_Up; + break; + case XKB_KEY_KP_Right: + sym = XKB_KEY_Right; + break; + case XKB_KEY_KP_Down: + sym = XKB_KEY_Down; + break; + case XKB_KEY_KP_Equal: + sym = XKB_KEY_equal; + break; + case XKB_KEY_KP_Multiply: + sym = XKB_KEY_asterisk; + break; + case XKB_KEY_KP_Add: + sym = XKB_KEY_plus; + break; + case XKB_KEY_KP_Separator: + /* Note this is actually locale-dependent and should mostly be + * a comma. But leave it as period until we one day start + * doing the right thing. */ + sym = XKB_KEY_period; + break; + case XKB_KEY_KP_Subtract: + sym = XKB_KEY_minus; + break; + case XKB_KEY_KP_Decimal: + sym = XKB_KEY_period; + break; + case XKB_KEY_KP_Divide: + sym = XKB_KEY_slash; + break; + case XKB_KEY_KP_0: + case XKB_KEY_KP_1: + case XKB_KEY_KP_2: + case XKB_KEY_KP_3: + case XKB_KEY_KP_4: + case XKB_KEY_KP_5: + case XKB_KEY_KP_6: + case XKB_KEY_KP_7: + case XKB_KEY_KP_8: + case XKB_KEY_KP_9: + sym = (sym - XKB_KEY_KP_0) + XKB_KEY_0; + break; + default: + break; + } + switch (sym) { case XKB_KEY_F11: if (state == WL_KEYBOARD_KEY_STATE_RELEASED) -- 1.7.10.4