Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 ui/sdl2.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index e7a30b3..ac3ac19 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -33,6 +33,7 @@
 
 #include "qemu-common.h"
 #include "ui/console.h"
+#include "ui/input.h"
 #include "sysemu/sysemu.h"
 #include "x_keymap.h"
 #include "sdl_zoom.h"
@@ -236,9 +237,7 @@ static void reset_keys(void)
     int i;
     for(i = 0; i < 256; i++) {
         if (modifiers_state[i]) {
-            if (i & SCANCODE_GREY)
-                kbd_put_keycode(SCANCODE_EMUL0);
-            kbd_put_keycode(i | SCANCODE_UP);
+            qemu_input_event_send_key_number(NULL, i, false);
             modifiers_state[i] = 0;
         }
     }
@@ -246,11 +245,12 @@ static void reset_keys(void)
 
 static void sdl_process_key(SDL_KeyboardEvent *ev)
 {
-    int keycode, v;
+    int keycode;
 
+#if 0
     if (ev->keysym.sym == SDLK_PAUSE) {
         /* specific case */
-        v = 0;
+        int v = 0;
         if (ev->type == SDL_KEYUP)
             v |= SCANCODE_UP;
         kbd_put_keycode(0xe1);
@@ -258,6 +258,7 @@ static void sdl_process_key(SDL_KeyboardEvent *ev)
         kbd_put_keycode(0x45 | v);
         return;
     }
+#endif
 
     if (kbd_layout) {
         keycode = sdl_keyevent_to_keycode_generic(ev);
@@ -284,18 +285,14 @@ static void sdl_process_key(SDL_KeyboardEvent *ev)
     case 0x45: /* num lock */
     case 0x3a: /* caps lock */
         /* SDL does not send the key up event, so we generate it */
-        kbd_put_keycode(keycode);
-        kbd_put_keycode(keycode | SCANCODE_UP);
+        qemu_input_event_send_key_number(NULL, keycode, true);
+        qemu_input_event_send_key_number(NULL, keycode, false);
         return;
     }
 
     /* now send the key code */
-    if (keycode & SCANCODE_GREY)
-        kbd_put_keycode(SCANCODE_EMUL0);
-    if (ev->type == SDL_KEYUP)
-        kbd_put_keycode(keycode | SCANCODE_UP);
-    else
-        kbd_put_keycode(keycode & SCANCODE_KEYCODEMASK);
+    qemu_input_event_send_key_number(NULL, keycode,
+                                     ev->type == SDL_KEYDOWN);
 }
 
 static void sdl_update_caption(struct sdl2_console_state *scon)
-- 
1.8.3.1


Reply via email to