]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
sdl2: use only QKeyCode in sdl2_process_key()
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 22 Jan 2019 09:28:10 +0000 (10:28 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 5 Feb 2019 09:45:44 +0000 (10:45 +0100)
Also: sdl2_process_key is never called with scon == NULL.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20190122092814.14919-5-kraxel@redhat.com

ui/sdl2-input.c

index 22e3336aab08697a34a23d7a87a5d046eb6bbb3d..664364a5e5be5b4a1cc1f5765919646a77984fe8 100644 (file)
@@ -34,20 +34,19 @@ void sdl2_process_key(struct sdl2_console *scon,
                       SDL_KeyboardEvent *ev)
 {
     int qcode;
-    QemuConsole *con = scon ? scon->dcl.con : NULL;
+    QemuConsole *con = scon->dcl.con;
 
     if (ev->keysym.scancode >= qemu_input_map_usb_to_qcode_len) {
         return;
     }
-
     qcode = qemu_input_map_usb_to_qcode[ev->keysym.scancode];
     qkbd_state_key_event(scon->kbd, qcode, ev->type == SDL_KEYDOWN);
 
     if (!qemu_console_is_graphic(con)) {
         bool ctrl = qkbd_state_modifier_get(scon->kbd, QKBD_MOD_CTRL);
         if (ev->type == SDL_KEYDOWN) {
-            switch (ev->keysym.scancode) {
-            case SDL_SCANCODE_RETURN:
+            switch (qcode) {
+            case Q_KEY_CODE_RET:
                 kbd_put_keysym_console(con, '\n');
                 break;
             default: