summary refs log tree commit diff stats
path: root/ui/console.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-04-09 12:02:19 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-04-09 12:02:19 +0100
commitb2c1742da0c79dd52080260edacaf0a7b6d309e5 (patch)
tree94fc8886fa904d79c5c01bf31cd65f56c54cb668 /ui/console.c
parent2a6bcfdebe4115993a032395d459f5e0cf27a01e (diff)
parent1458da9131c39ca99699b521436d6ce72d7c7981 (diff)
downloadfocaccia-qemu-b2c1742da0c79dd52080260edacaf0a7b6d309e5.tar.gz
focaccia-qemu-b2c1742da0c79dd52080260edacaf0a7b6d309e5.zip
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180409-pull-request' into staging
sdl2: fix kbd regression (compared to sdl1), cleanups.

# gpg: Signature made Mon 09 Apr 2018 10:40:21 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# 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-20180409-pull-request:
  sdl2: drop dead code
  sdl2: drop QEMU_KEY_BACKSPACE special case
  sdl2: enable ctrl modifier keys for text consoles
  sdl2: track kbd modifier state unconditionally
  ui: add ctrl modifier support to kbd_put_qcode_console()
  sdl2: Remove unused epoxy include

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/console.c')
-rw-r--r--ui/console.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ui/console.c b/ui/console.c
index 530a491987..3fb2f4e09f 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1191,11 +1191,22 @@ static const int qcode_to_keysym[Q_KEY_CODE__MAX] = {
     [Q_KEY_CODE_BACKSPACE] = QEMU_KEY_BACKSPACE,
 };
 
-bool kbd_put_qcode_console(QemuConsole *s, int qcode)
+static const int ctrl_qcode_to_keysym[Q_KEY_CODE__MAX] = {
+    [Q_KEY_CODE_UP]     = QEMU_KEY_CTRL_UP,
+    [Q_KEY_CODE_DOWN]   = QEMU_KEY_CTRL_DOWN,
+    [Q_KEY_CODE_RIGHT]  = QEMU_KEY_CTRL_RIGHT,
+    [Q_KEY_CODE_LEFT]   = QEMU_KEY_CTRL_LEFT,
+    [Q_KEY_CODE_HOME]   = QEMU_KEY_CTRL_HOME,
+    [Q_KEY_CODE_END]    = QEMU_KEY_CTRL_END,
+    [Q_KEY_CODE_PGUP]   = QEMU_KEY_CTRL_PAGEUP,
+    [Q_KEY_CODE_PGDN]   = QEMU_KEY_CTRL_PAGEDOWN,
+};
+
+bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl)
 {
     int keysym;
 
-    keysym = qcode_to_keysym[qcode];
+    keysym = ctrl ? ctrl_qcode_to_keysym[qcode] : qcode_to_keysym[qcode];
     if (keysym == 0) {
         return false;
     }