Received: from eggs.gnu.org ([2001:4830:134:3::10]:50874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5TIP-0005dU-NX for qemu-devel@nongnu.org; Mon, 09 Apr 2018 05:41:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5TIL-0003ar-UO for qemu-devel@nongnu.org; Mon, 09 Apr 2018 05:41:05 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38688 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5TIL-0003aa-Px for qemu-devel@nongnu.org; Mon, 09 Apr 2018 05:41:01 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 53E89401CC41 for ; Mon, 9 Apr 2018 09:41:01 +0000 (UTC) From: Gerd Hoffmann Date: Mon, 9 Apr 2018 11:40:57 +0200 Message-Id: <20180409094100.27650-4-kraxel@redhat.com> In-Reply-To: <20180409094100.27650-1-kraxel@redhat.com> References: <20180409094100.27650-1-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 3/6] sdl2: track kbd modifier state unconditionally List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann For both grapical and text consoles. Signed-off-by: Gerd Hoffmann Message-id: 20180321135041.15768-3-kraxel@redhat.com Signed-off-by: Gerd Hoffmann --- 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