diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2014-06-02 16:10:12 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2014-06-02 16:10:12 +0100 |
| commit | 1673e89e93e08cbfee7c9b552008e5b39469ad0e (patch) | |
| tree | ee271bf37bcbff51f8b9436ba4820bc08afb653f /ui/console.c | |
| parent | 36f5db59cff03fd289541da104249f00356a19a7 (diff) | |
| parent | f2335791fd0ceb2f9e3cc99b57bfd9c63d98baf0 (diff) | |
| download | focaccia-qemu-1673e89e93e08cbfee7c9b552008e5b39469ad0e.tar.gz focaccia-qemu-1673e89e93e08cbfee7c9b552008e5b39469ad0e.zip | |
Merge remote-tracking branch 'remotes/kraxel/tags/pull-sdl-3' into staging
sdl2: add support for text consoles # gpg: Signature made Mon 02 Jun 2014 15:35:20 BST using RSA key ID D3E87138 # 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>" * remotes/kraxel/tags/pull-sdl-3: sdl2: textinput + terminal sdl2: make Ctrl-Alt-<nr> hotkeys show and hide windows console: add kbd_put_string_console console: add kbd_put_qcode_console Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/console.c')
| -rw-r--r-- | ui/console.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/ui/console.c b/ui/console.c index 75ec3afcf7..2ce55a69d0 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1109,6 +1109,39 @@ void kbd_put_keysym_console(QemuConsole *s, int keysym) } } +static const int qcode_to_keysym[Q_KEY_CODE_MAX] = { + [Q_KEY_CODE_UP] = QEMU_KEY_UP, + [Q_KEY_CODE_DOWN] = QEMU_KEY_DOWN, + [Q_KEY_CODE_RIGHT] = QEMU_KEY_RIGHT, + [Q_KEY_CODE_LEFT] = QEMU_KEY_LEFT, + [Q_KEY_CODE_HOME] = QEMU_KEY_HOME, + [Q_KEY_CODE_END] = QEMU_KEY_END, + [Q_KEY_CODE_PGUP] = QEMU_KEY_PAGEUP, + [Q_KEY_CODE_PGDN] = QEMU_KEY_PAGEDOWN, + [Q_KEY_CODE_DELETE] = QEMU_KEY_DELETE, +}; + +bool kbd_put_qcode_console(QemuConsole *s, int qcode) +{ + int keysym; + + keysym = qcode_to_keysym[qcode]; + if (keysym == 0) { + return false; + } + kbd_put_keysym_console(s, keysym); + return true; +} + +void kbd_put_string_console(QemuConsole *s, const char *str, int len) +{ + int i; + + for (i = 0; i < len && str[i]; i++) { + kbd_put_keysym_console(s, str[i]); + } +} + void kbd_put_keysym(int keysym) { kbd_put_keysym_console(active_console, keysym); |