From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHu67-0001WD-2F for qemu-devel@nongnu.org; Mon, 24 Feb 2014 06:53:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHu5x-0000vS-4L for qemu-devel@nongnu.org; Mon, 24 Feb 2014 06:53:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHu5w-0000v5-Su for qemu-devel@nongnu.org; Mon, 24 Feb 2014 06:53:13 -0500 From: Gerd Hoffmann Date: Mon, 24 Feb 2014 12:52:24 +0100 Message-Id: <1393242771-28076-18-git-send-email-kraxel@redhat.com> In-Reply-To: <1393242771-28076-1-git-send-email-kraxel@redhat.com> References: <1393242771-28076-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 17/44] 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 Signed-off-by: Gerd Hoffmann --- 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