diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-07-27 15:27:06 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-07-27 15:27:06 +0100 |
commit | e01151de165070c25a1b202e9e2392950bd7c8da (patch) | |
tree | ed0caa6f429d5b388e9c9bacf23fd84b928291e5 /ui | |
parent | 6be37cc583454ee27587a79b6008e22c3cc1a763 (diff) | |
parent | 7c388dbd0b2c54b3d836c23ea43e2cee38de66a4 (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20170727-pull-request' into staging
ui: keymap fixes for 2.10
# gpg: Signature made Thu 27 Jul 2017 15:00:06 BST
# gpg: using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/ui-20170727-pull-request:
ps2: fix sending of PAUSE/BREAK scancodes
ui: drop altgr and altgr_r QKeyCodes
ps2: enable multimedia keys
ui: add multimedia keys
ui: update keymaps
ui: move qemu_input_linux_to_qcode()
ui: add next and prior keysyms
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/curses_keys.h | 2 | ||||
-rw-r--r-- | ui/input-keymap.c | 169 | ||||
-rw-r--r-- | ui/input-linux.c | 113 | ||||
-rw-r--r-- | ui/keymaps.h | 1 | ||||
-rw-r--r-- | ui/spice-input.c | 20 | ||||
-rw-r--r-- | ui/vnc_keysym.h | 2 |
6 files changed, 192 insertions, 115 deletions
diff --git a/ui/curses_keys.h b/ui/curses_keys.h index e39ef9e718..e9195a1671 100644 --- a/ui/curses_keys.h +++ b/ui/curses_keys.h @@ -480,7 +480,9 @@ static const name2keysym_t name2keysym[] = { { "Left", KEY_LEFT }, { "Up", KEY_UP }, { "Down", KEY_DOWN }, + { "Next", KEY_NPAGE }, { "Page_Down", KEY_NPAGE }, + { "Prior", KEY_PPAGE }, { "Page_Up", KEY_PPAGE }, { "Insert", KEY_IC }, { "Delete", KEY_DC }, diff --git a/ui/input-keymap.c b/ui/input-keymap.c index 8a1476fc48..0d9ddde9c9 100644 --- a/ui/input-keymap.c +++ b/ui/input-keymap.c @@ -3,14 +3,149 @@ #include "ui/keymaps.h" #include "ui/input.h" +#include "standard-headers/linux/input.h" + +static int linux_to_qcode[KEY_CNT] = { + [KEY_ESC] = Q_KEY_CODE_ESC, + [KEY_1] = Q_KEY_CODE_1, + [KEY_2] = Q_KEY_CODE_2, + [KEY_3] = Q_KEY_CODE_3, + [KEY_4] = Q_KEY_CODE_4, + [KEY_5] = Q_KEY_CODE_5, + [KEY_6] = Q_KEY_CODE_6, + [KEY_7] = Q_KEY_CODE_7, + [KEY_8] = Q_KEY_CODE_8, + [KEY_9] = Q_KEY_CODE_9, + [KEY_0] = Q_KEY_CODE_0, + [KEY_MINUS] = Q_KEY_CODE_MINUS, + [KEY_EQUAL] = Q_KEY_CODE_EQUAL, + [KEY_BACKSPACE] = Q_KEY_CODE_BACKSPACE, + [KEY_TAB] = Q_KEY_CODE_TAB, + [KEY_Q] = Q_KEY_CODE_Q, + [KEY_W] = Q_KEY_CODE_W, + [KEY_E] = Q_KEY_CODE_E, + [KEY_R] = Q_KEY_CODE_R, + [KEY_T] = Q_KEY_CODE_T, + [KEY_Y] = Q_KEY_CODE_Y, + [KEY_U] = Q_KEY_CODE_U, + [KEY_I] = Q_KEY_CODE_I, + [KEY_O] = Q_KEY_CODE_O, + [KEY_P] = Q_KEY_CODE_P, + [KEY_LEFTBRACE] = Q_KEY_CODE_BRACKET_LEFT, + [KEY_RIGHTBRACE] = Q_KEY_CODE_BRACKET_RIGHT, + [KEY_ENTER] = Q_KEY_CODE_RET, + [KEY_LEFTCTRL] = Q_KEY_CODE_CTRL, + [KEY_A] = Q_KEY_CODE_A, + [KEY_S] = Q_KEY_CODE_S, + [KEY_D] = Q_KEY_CODE_D, + [KEY_F] = Q_KEY_CODE_F, + [KEY_G] = Q_KEY_CODE_G, + [KEY_H] = Q_KEY_CODE_H, + [KEY_J] = Q_KEY_CODE_J, + [KEY_K] = Q_KEY_CODE_K, + [KEY_L] = Q_KEY_CODE_L, + [KEY_SEMICOLON] = Q_KEY_CODE_SEMICOLON, + [KEY_APOSTROPHE] = Q_KEY_CODE_APOSTROPHE, + [KEY_GRAVE] = Q_KEY_CODE_GRAVE_ACCENT, + [KEY_LEFTSHIFT] = Q_KEY_CODE_SHIFT, + [KEY_BACKSLASH] = Q_KEY_CODE_BACKSLASH, + [KEY_102ND] = Q_KEY_CODE_LESS, + [KEY_Z] = Q_KEY_CODE_Z, + [KEY_X] = Q_KEY_CODE_X, + [KEY_C] = Q_KEY_CODE_C, + [KEY_V] = Q_KEY_CODE_V, + [KEY_B] = Q_KEY_CODE_B, + [KEY_N] = Q_KEY_CODE_N, + [KEY_M] = Q_KEY_CODE_M, + [KEY_COMMA] = Q_KEY_CODE_COMMA, + [KEY_DOT] = Q_KEY_CODE_DOT, + [KEY_SLASH] = Q_KEY_CODE_SLASH, + [KEY_RIGHTSHIFT] = Q_KEY_CODE_SHIFT_R, + [KEY_LEFTALT] = Q_KEY_CODE_ALT, + [KEY_SPACE] = Q_KEY_CODE_SPC, + [KEY_CAPSLOCK] = Q_KEY_CODE_CAPS_LOCK, + [KEY_F1] = Q_KEY_CODE_F1, + [KEY_F2] = Q_KEY_CODE_F2, + [KEY_F3] = Q_KEY_CODE_F3, + [KEY_F4] = Q_KEY_CODE_F4, + [KEY_F5] = Q_KEY_CODE_F5, + [KEY_F6] = Q_KEY_CODE_F6, + [KEY_F7] = Q_KEY_CODE_F7, + [KEY_F8] = Q_KEY_CODE_F8, + [KEY_F9] = Q_KEY_CODE_F9, + [KEY_F10] = Q_KEY_CODE_F10, + [KEY_NUMLOCK] = Q_KEY_CODE_NUM_LOCK, + [KEY_SCROLLLOCK] = Q_KEY_CODE_SCROLL_LOCK, + [KEY_KP0] = Q_KEY_CODE_KP_0, + [KEY_KP1] = Q_KEY_CODE_KP_1, + [KEY_KP2] = Q_KEY_CODE_KP_2, + [KEY_KP3] = Q_KEY_CODE_KP_3, + [KEY_KP4] = Q_KEY_CODE_KP_4, + [KEY_KP5] = Q_KEY_CODE_KP_5, + [KEY_KP6] = Q_KEY_CODE_KP_6, + [KEY_KP7] = Q_KEY_CODE_KP_7, + [KEY_KP8] = Q_KEY_CODE_KP_8, + [KEY_KP9] = Q_KEY_CODE_KP_9, + [KEY_KPMINUS] = Q_KEY_CODE_KP_SUBTRACT, + [KEY_KPPLUS] = Q_KEY_CODE_KP_ADD, + [KEY_KPDOT] = Q_KEY_CODE_KP_DECIMAL, + [KEY_KPENTER] = Q_KEY_CODE_KP_ENTER, + [KEY_KPSLASH] = Q_KEY_CODE_KP_DIVIDE, + [KEY_KPASTERISK] = Q_KEY_CODE_KP_MULTIPLY, + [KEY_F11] = Q_KEY_CODE_F11, + [KEY_F12] = Q_KEY_CODE_F12, + [KEY_RO] = Q_KEY_CODE_RO, + [KEY_HIRAGANA] = Q_KEY_CODE_HIRAGANA, + [KEY_HENKAN] = Q_KEY_CODE_HENKAN, + [KEY_RIGHTCTRL] = Q_KEY_CODE_CTRL_R, + [KEY_SYSRQ] = Q_KEY_CODE_SYSRQ, + [KEY_RIGHTALT] = Q_KEY_CODE_ALT_R, + [KEY_HOME] = Q_KEY_CODE_HOME, + [KEY_UP] = Q_KEY_CODE_UP, + [KEY_PAGEUP] = Q_KEY_CODE_PGUP, + [KEY_LEFT] = Q_KEY_CODE_LEFT, + [KEY_RIGHT] = Q_KEY_CODE_RIGHT, + [KEY_END] = Q_KEY_CODE_END, + [KEY_DOWN] = Q_KEY_CODE_DOWN, + [KEY_PAGEDOWN] = Q_KEY_CODE_PGDN, + [KEY_INSERT] = Q_KEY_CODE_INSERT, + [KEY_DELETE] = Q_KEY_CODE_DELETE, + [KEY_POWER] = Q_KEY_CODE_POWER, + [KEY_KPCOMMA] = Q_KEY_CODE_KP_COMMA, + [KEY_YEN] = Q_KEY_CODE_YEN, + [KEY_LEFTMETA] = Q_KEY_CODE_META_L, + [KEY_RIGHTMETA] = Q_KEY_CODE_META_R, + [KEY_MENU] = Q_KEY_CODE_MENU, + + [KEY_SLEEP] = Q_KEY_CODE_SLEEP, + [KEY_WAKEUP] = Q_KEY_CODE_WAKE, + [KEY_CALC] = Q_KEY_CODE_CALCULATOR, + [KEY_MAIL] = Q_KEY_CODE_MAIL, + [KEY_COMPUTER] = Q_KEY_CODE_COMPUTER, + + [KEY_STOP] = Q_KEY_CODE_AC_STOP, + [KEY_BOOKMARKS] = Q_KEY_CODE_AC_BOOKMARKS, + [KEY_BACK] = Q_KEY_CODE_AC_BACK, + [KEY_FORWARD] = Q_KEY_CODE_AC_FORWARD, + [KEY_HOMEPAGE] = Q_KEY_CODE_AC_HOME, + [KEY_REFRESH] = Q_KEY_CODE_AC_REFRESH, + [KEY_FIND] = Q_KEY_CODE_AC_SEARCH, + + [KEY_NEXTSONG] = Q_KEY_CODE_AUDIONEXT, + [KEY_PREVIOUSSONG] = Q_KEY_CODE_AUDIOPREV, + [KEY_STOPCD] = Q_KEY_CODE_AUDIOSTOP, + [KEY_PLAYCD] = Q_KEY_CODE_AUDIOPLAY, + [KEY_MUTE] = Q_KEY_CODE_AUDIOMUTE, + [KEY_VOLUMEDOWN] = Q_KEY_CODE_VOLUMEDOWN, + [KEY_VOLUMEUP] = Q_KEY_CODE_VOLUMEUP, +}; + static const int qcode_to_number[] = { [Q_KEY_CODE_SHIFT] = 0x2a, [Q_KEY_CODE_SHIFT_R] = 0x36, [Q_KEY_CODE_ALT] = 0x38, [Q_KEY_CODE_ALT_R] = 0xb8, - [Q_KEY_CODE_ALTGR] = 0x64, - [Q_KEY_CODE_ALTGR_R] = 0xe4, [Q_KEY_CODE_CTRL] = 0x1d, [Q_KEY_CODE_CTRL_R] = 0x9d, @@ -98,6 +233,7 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_KP_ENTER] = 0x9c, [Q_KEY_CODE_KP_DECIMAL] = 0x53, [Q_KEY_CODE_SYSRQ] = 0x54, + [Q_KEY_CODE_PAUSE] = 0xc6, [Q_KEY_CODE_KP_0] = 0x52, [Q_KEY_CODE_KP_1] = 0x4f, @@ -133,14 +269,43 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_RO] = 0x73, [Q_KEY_CODE_HIRAGANA] = 0x70, [Q_KEY_CODE_HENKAN] = 0x79, + [Q_KEY_CODE_POWER] = 0xde, [Q_KEY_CODE_YEN] = 0x7d, [Q_KEY_CODE_KP_COMMA] = 0x7e, + [Q_KEY_CODE_SLEEP] = 0xdf, + [Q_KEY_CODE_WAKE] = 0xe3, + [Q_KEY_CODE_CALCULATOR] = 0xa1, + [Q_KEY_CODE_MAIL] = 0xec, + [Q_KEY_CODE_COMPUTER] = 0xeb, + + [Q_KEY_CODE_AC_STOP] = 0xe8, + [Q_KEY_CODE_AC_BOOKMARKS] = 0xe6, + [Q_KEY_CODE_AC_BACK] = 0xea, + [Q_KEY_CODE_AC_FORWARD] = 0xe9, + [Q_KEY_CODE_AC_HOME] = 0xb2, + [Q_KEY_CODE_AC_REFRESH] = 0xe7, + [Q_KEY_CODE_AC_SEARCH] = 0xe5, + + [Q_KEY_CODE_AUDIONEXT] = 0x99, + [Q_KEY_CODE_AUDIOPREV] = 0x90, + [Q_KEY_CODE_AUDIOSTOP] = 0xa4, + [Q_KEY_CODE_AUDIOPLAY] = 0xa2, + [Q_KEY_CODE_AUDIOMUTE] = 0xa0, + [Q_KEY_CODE_VOLUMEDOWN] = 0xae, + [Q_KEY_CODE_VOLUMEUP] = 0xb0, + [Q_KEY_CODE__MAX] = 0, }; static int number_to_qcode[0x100]; +int qemu_input_linux_to_qcode(unsigned int lnx) +{ + assert(lnx < KEY_CNT); + return linux_to_qcode[lnx]; +} + int qemu_input_key_value_to_number(const KeyValue *value) { if (value->type == KEY_VALUE_KIND_QCODE) { diff --git a/ui/input-linux.c b/ui/input-linux.c index 49d52a69cc..9720333b2c 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -16,119 +16,6 @@ #include <sys/ioctl.h> #include "standard-headers/linux/input.h" -static int linux_to_qcode[KEY_CNT] = { - [KEY_ESC] = Q_KEY_CODE_ESC, - [KEY_1] = Q_KEY_CODE_1, - [KEY_2] = Q_KEY_CODE_2, - [KEY_3] = Q_KEY_CODE_3, - [KEY_4] = Q_KEY_CODE_4, - [KEY_5] = Q_KEY_CODE_5, - [KEY_6] = Q_KEY_CODE_6, - [KEY_7] = Q_KEY_CODE_7, - [KEY_8] = Q_KEY_CODE_8, - [KEY_9] = Q_KEY_CODE_9, - [KEY_0] = Q_KEY_CODE_0, - [KEY_MINUS] = Q_KEY_CODE_MINUS, - [KEY_EQUAL] = Q_KEY_CODE_EQUAL, - [KEY_BACKSPACE] = Q_KEY_CODE_BACKSPACE, - [KEY_TAB] = Q_KEY_CODE_TAB, - [KEY_Q] = Q_KEY_CODE_Q, - [KEY_W] = Q_KEY_CODE_W, - [KEY_E] = Q_KEY_CODE_E, - [KEY_R] = Q_KEY_CODE_R, - [KEY_T] = Q_KEY_CODE_T, - [KEY_Y] = Q_KEY_CODE_Y, - [KEY_U] = Q_KEY_CODE_U, - [KEY_I] = Q_KEY_CODE_I, - [KEY_O] = Q_KEY_CODE_O, - [KEY_P] = Q_KEY_CODE_P, - [KEY_LEFTBRACE] = Q_KEY_CODE_BRACKET_LEFT, - [KEY_RIGHTBRACE] = Q_KEY_CODE_BRACKET_RIGHT, - [KEY_ENTER] = Q_KEY_CODE_RET, - [KEY_LEFTCTRL] = Q_KEY_CODE_CTRL, - [KEY_A] = Q_KEY_CODE_A, - [KEY_S] = Q_KEY_CODE_S, - [KEY_D] = Q_KEY_CODE_D, - [KEY_F] = Q_KEY_CODE_F, - [KEY_G] = Q_KEY_CODE_G, - [KEY_H] = Q_KEY_CODE_H, - [KEY_J] = Q_KEY_CODE_J, - [KEY_K] = Q_KEY_CODE_K, - [KEY_L] = Q_KEY_CODE_L, - [KEY_SEMICOLON] = Q_KEY_CODE_SEMICOLON, - [KEY_APOSTROPHE] = Q_KEY_CODE_APOSTROPHE, - [KEY_GRAVE] = Q_KEY_CODE_GRAVE_ACCENT, - [KEY_LEFTSHIFT] = Q_KEY_CODE_SHIFT, - [KEY_BACKSLASH] = Q_KEY_CODE_BACKSLASH, - [KEY_102ND] = Q_KEY_CODE_LESS, - [KEY_Z] = Q_KEY_CODE_Z, - [KEY_X] = Q_KEY_CODE_X, - [KEY_C] = Q_KEY_CODE_C, - [KEY_V] = Q_KEY_CODE_V, - [KEY_B] = Q_KEY_CODE_B, - [KEY_N] = Q_KEY_CODE_N, - [KEY_M] = Q_KEY_CODE_M, - [KEY_COMMA] = Q_KEY_CODE_COMMA, - [KEY_DOT] = Q_KEY_CODE_DOT, - [KEY_SLASH] = Q_KEY_CODE_SLASH, - [KEY_RIGHTSHIFT] = Q_KEY_CODE_SHIFT_R, - [KEY_LEFTALT] = Q_KEY_CODE_ALT, - [KEY_SPACE] = Q_KEY_CODE_SPC, - [KEY_CAPSLOCK] = Q_KEY_CODE_CAPS_LOCK, - [KEY_F1] = Q_KEY_CODE_F1, - [KEY_F2] = Q_KEY_CODE_F2, - [KEY_F3] = Q_KEY_CODE_F3, - [KEY_F4] = Q_KEY_CODE_F4, - [KEY_F5] = Q_KEY_CODE_F5, - [KEY_F6] = Q_KEY_CODE_F6, - [KEY_F7] = Q_KEY_CODE_F7, - [KEY_F8] = Q_KEY_CODE_F8, - [KEY_F9] = Q_KEY_CODE_F9, - [KEY_F10] = Q_KEY_CODE_F10, - [KEY_NUMLOCK] = Q_KEY_CODE_NUM_LOCK, - [KEY_SCROLLLOCK] = Q_KEY_CODE_SCROLL_LOCK, - [KEY_KP0] = Q_KEY_CODE_KP_0, - [KEY_KP1] = Q_KEY_CODE_KP_1, - [KEY_KP2] = Q_KEY_CODE_KP_2, - [KEY_KP3] = Q_KEY_CODE_KP_3, - [KEY_KP4] = Q_KEY_CODE_KP_4, - [KEY_KP5] = Q_KEY_CODE_KP_5, - [KEY_KP6] = Q_KEY_CODE_KP_6, - [KEY_KP7] = Q_KEY_CODE_KP_7, - [KEY_KP8] = Q_KEY_CODE_KP_8, - [KEY_KP9] = Q_KEY_CODE_KP_9, - [KEY_KPMINUS] = Q_KEY_CODE_KP_SUBTRACT, - [KEY_KPPLUS] = Q_KEY_CODE_KP_ADD, - [KEY_KPDOT] = Q_KEY_CODE_KP_DECIMAL, - [KEY_KPENTER] = Q_KEY_CODE_KP_ENTER, - [KEY_KPSLASH] = Q_KEY_CODE_KP_DIVIDE, - [KEY_KPASTERISK] = Q_KEY_CODE_KP_MULTIPLY, - [KEY_F11] = Q_KEY_CODE_F11, - [KEY_F12] = Q_KEY_CODE_F12, - [KEY_RIGHTCTRL] = Q_KEY_CODE_CTRL_R, - [KEY_SYSRQ] = Q_KEY_CODE_SYSRQ, - [KEY_RIGHTALT] = Q_KEY_CODE_ALT_R, - [KEY_HOME] = Q_KEY_CODE_HOME, - [KEY_UP] = Q_KEY_CODE_UP, - [KEY_PAGEUP] = Q_KEY_CODE_PGUP, - [KEY_LEFT] = Q_KEY_CODE_LEFT, - [KEY_RIGHT] = Q_KEY_CODE_RIGHT, - [KEY_END] = Q_KEY_CODE_END, - [KEY_DOWN] = Q_KEY_CODE_DOWN, - [KEY_PAGEDOWN] = Q_KEY_CODE_PGDN, - [KEY_INSERT] = Q_KEY_CODE_INSERT, - [KEY_DELETE] = Q_KEY_CODE_DELETE, - [KEY_LEFTMETA] = Q_KEY_CODE_META_L, - [KEY_RIGHTMETA] = Q_KEY_CODE_META_R, - [KEY_MENU] = Q_KEY_CODE_MENU, -}; - -static int qemu_input_linux_to_qcode(unsigned int lnx) -{ - assert(lnx < KEY_CNT); - return linux_to_qcode[lnx]; -} - static bool linux_is_button(unsigned int lnx) { if (lnx < 0x100) { diff --git a/ui/keymaps.h b/ui/keymaps.h index 47d061343e..8757465529 100644 --- a/ui/keymaps.h +++ b/ui/keymaps.h @@ -59,6 +59,7 @@ typedef struct { /* "grey" keys will usually need a 0xe0 prefix */ #define SCANCODE_GREY 0x80 #define SCANCODE_EMUL0 0xE0 +#define SCANCODE_EMUL1 0xE1 /* "up" flag */ #define SCANCODE_UP 0x80 diff --git a/ui/spice-input.c b/ui/spice-input.c index 918580239d..cda9976469 100644 --- a/ui/spice-input.c +++ b/ui/spice-input.c @@ -32,6 +32,7 @@ typedef struct QemuSpiceKbd { SpiceKbdInstance sin; int ledstate; bool emul0; + size_t pauseseq; } QemuSpiceKbd; static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag); @@ -64,6 +65,25 @@ static void kbd_push_key(SpiceKbdInstance *sin, uint8_t scancode) keycode |= SCANCODE_GREY; } + if (scancode == SCANCODE_EMUL1) { + kbd->pauseseq++; + return; + } else if (kbd->pauseseq == 1) { + if (keycode == 0x1d) { + kbd->pauseseq++; + return; + } else { + kbd->pauseseq = 0; + } + } else if (kbd->pauseseq == 2) { + if (keycode == 0x45) { + qemu_input_event_send_key_qcode(NULL, Q_KEY_CODE_PAUSE, !up); + kbd->pauseseq = 0; + return; + } + kbd->pauseseq = 0; + } + qemu_input_event_send_key_number(NULL, keycode, !up); } diff --git a/ui/vnc_keysym.h b/ui/vnc_keysym.h index 7fa2bc1f1c..e8a2ec73c5 100644 --- a/ui/vnc_keysym.h +++ b/ui/vnc_keysym.h @@ -254,7 +254,9 @@ static const name2keysym_t name2keysym[]={ {"Left", 0xff51}, /* XK_Left */ {"Up", 0xff52}, /* XK_Up */ {"Down", 0xff54}, /* XK_Down */ +{"Next", 0xff56}, {"Page_Down", 0xff56}, /* XK_Page_Down */ +{"Prior", 0xff55}, {"Page_Up", 0xff55}, /* XK_Page_Up */ {"Insert", 0xff63}, /* XK_Insert */ {"Delete", 0xffff}, /* XK_Delete */ |