From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsVkI-0001RU-Dh for qemu-devel@nongnu.org; Mon, 16 Dec 2013 05:50:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsVk3-0000yc-33 for qemu-devel@nongnu.org; Mon, 16 Dec 2013 05:49:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsVjs-0000p9-AQ for qemu-devel@nongnu.org; Mon, 16 Dec 2013 05:49:39 -0500 From: Gerd Hoffmann Date: Mon, 16 Dec 2013 11:48:53 +0100 Message-Id: <1387190958-19470-18-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> Subject: [Qemu-devel] [PATCH 17/42] input: keyboard: switch spice ui to new core List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Anthony Liguori --- ui/spice-input.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ui/spice-input.c b/ui/spice-input.c index 3beb8de..c9df699 100644 --- a/ui/spice-input.c +++ b/ui/spice-input.c @@ -26,12 +26,15 @@ #include "qemu-common.h" #include "ui/qemu-spice.h" #include "ui/console.h" +#include "ui/keymaps.h" +#include "ui/input.h" /* keyboard bits */ typedef struct QemuSpiceKbd { SpiceKbdInstance sin; int ledstate; + bool emul0; } QemuSpiceKbd; static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag); @@ -47,9 +50,24 @@ static const SpiceKbdInterface kbd_interface = { .get_leds = kbd_get_leds, }; -static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag) +static void kbd_push_key(SpiceKbdInstance *sin, uint8_t scancode) { - kbd_put_keycode(frag); + QemuSpiceKbd *kbd = container_of(sin, QemuSpiceKbd, sin); + int keycode; + bool up; + + if (scancode == SCANCODE_EMUL0) { + kbd->emul0 = true; + return; + } + keycode = scancode & ~SCANCODE_UP; + up = scancode & SCANCODE_UP; + if (kbd->emul0) { + kbd->emul0 = false; + keycode |= SCANCODE_GREY; + } + + qemu_input_event_send_key_number(NULL, keycode, !up); } static uint8_t kbd_get_leds(SpiceKbdInstance *sin) -- 1.8.3.1