From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, balaton@eik.bme.hu
Subject: [Qemu-devel] [PATCH 2/5] sdl2: track kbd modifier state unconditionally
Date: Wed, 21 Mar 2018 14:50:37 +0100 [thread overview]
Message-ID: <20180321135041.15768-3-kraxel@redhat.com> (raw)
In-Reply-To: <20180321135041.15768-1-kraxel@redhat.com>
For both grapical and text consoles.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/sdl2-input.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c
index 35d35c14c4..8d0d9ba17c 100644
--- a/ui/sdl2-input.c
+++ b/ui/sdl2-input.c
@@ -60,23 +60,7 @@ void sdl2_process_key(struct sdl2_console *scon,
qcode = qemu_input_map_usb_to_qcode[ev->keysym.scancode];
- if (!qemu_console_is_graphic(con)) {
- if (ev->type == SDL_KEYDOWN) {
- switch (ev->keysym.scancode) {
- case SDL_SCANCODE_RETURN:
- kbd_put_keysym_console(con, '\n');
- break;
- case SDL_SCANCODE_BACKSPACE:
- kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE);
- break;
- default:
- kbd_put_qcode_console(con, qcode, false);
- break;
- }
- }
- return;
- }
-
+ /* modifier state tracking */
switch (ev->keysym.scancode) {
#if 0
case SDL_SCANCODE_NUMLOCKCLEAR:
@@ -99,8 +83,27 @@ void sdl2_process_key(struct sdl2_console *scon,
} else {
modifiers_state[ev->keysym.scancode] = 1;
}
- /* fall though */
+ break;
default:
+ /* nothing */
+ break;
+ }
+
+ if (!qemu_console_is_graphic(con)) {
+ if (ev->type == SDL_KEYDOWN) {
+ switch (ev->keysym.scancode) {
+ case SDL_SCANCODE_RETURN:
+ kbd_put_keysym_console(con, '\n');
+ break;
+ case SDL_SCANCODE_BACKSPACE:
+ kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE);
+ break;
+ default:
+ kbd_put_qcode_console(con, qcode, false);
+ break;
+ }
+ }
+ } else {
qemu_input_event_send_key_qcode(con, qcode,
ev->type == SDL_KEYDOWN);
}
--
2.9.3
next prev parent reply other threads:[~2018-03-21 13:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 13:50 [Qemu-devel] [PATCH 0/5] sdl2 text console fixes and cleanups Gerd Hoffmann
2018-03-21 13:50 ` [Qemu-devel] [PATCH 1/5] ui: add ctrl modifier support to kbd_put_qcode_console() Gerd Hoffmann
2018-03-21 13:50 ` Gerd Hoffmann [this message]
2018-03-21 13:50 ` [Qemu-devel] [PATCH 3/5] sdl2: enable ctrl modifier keys for text consoles Gerd Hoffmann
2018-03-21 13:50 ` [Qemu-devel] [PATCH 4/5] sdl2: drop QEMU_KEY_BACKSPACE special case Gerd Hoffmann
2018-03-21 13:50 ` [Qemu-devel] [PATCH 5/5] sdl2: drop dead code Gerd Hoffmann
2018-04-08 10:52 ` [Qemu-devel] [PATCH 0/5] sdl2 text console fixes and cleanups BALATON Zoltan
2018-04-09 9:43 ` Gerd Hoffmann
2018-04-09 10:16 ` Mark Cave-Ayland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180321135041.15768-3-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).