From patchwork Mon Dec 16 10:48:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 301691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 870192C009D for ; Mon, 16 Dec 2013 23:03:01 +1100 (EST) Received: from localhost ([::1]:55272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsVpr-0001CG-B5 for incoming@patchwork.ozlabs.org; Mon, 16 Dec 2013 05:55:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsVjz-000198-Vx for qemu-devel@nongnu.org; Mon, 16 Dec 2013 05:49:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsVjs-0000ps-Hi for qemu-devel@nongnu.org; Mon, 16 Dec 2013 05:49:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsVjs-0000p7-98 for qemu-devel@nongnu.org; Mon, 16 Dec 2013 05:49:28 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBGAnRjR027959 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Dec 2013 05:49:27 -0500 Received: from nilsson.home.kraxel.org (vpn1-5-237.ams2.redhat.com [10.36.5.237]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rBGAnP7I025304; Mon, 16 Dec 2013 05:49:26 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id A67B781905; Mon, 16 Dec 2013 11:49:23 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 16 Dec 2013 11:48:51 +0100 Message-Id: <1387190958-19470-16-git-send-email-kraxel@redhat.com> In-Reply-To: <1387190958-19470-1-git-send-email-kraxel@redhat.com> References: <1387190958-19470-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann , Anthony Liguori Subject: [Qemu-devel] [PATCH 15/42] sdl2: switch keyboard handling to new core X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org --- 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)