spice-input.c (63e3555e80c31776285accbb4d0c14ae91c457dc) spice-input.c (de8f580b2360706d644296c690bb187ece6dc4c1)
1/*
2 * Copyright (C) 2010 Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 or
7 * (at your option) version 3 of the License.
8 *

--- 12 unchanged lines hidden (view full) ---

21#include <string.h>
22
23#include <spice.h>
24#include <spice/enums.h>
25
26#include "qemu-common.h"
27#include "ui/qemu-spice.h"
28#include "ui/console.h"
1/*
2 * Copyright (C) 2010 Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 or
7 * (at your option) version 3 of the License.
8 *

--- 12 unchanged lines hidden (view full) ---

21#include <string.h>
22
23#include <spice.h>
24#include <spice/enums.h>
25
26#include "qemu-common.h"
27#include "ui/qemu-spice.h"
28#include "ui/console.h"
29#include "ui/keymaps.h"
30#include "ui/input.h"
29
30/* keyboard bits */
31
32typedef struct QemuSpiceKbd {
33 SpiceKbdInstance sin;
34 int ledstate;
31
32/* keyboard bits */
33
34typedef struct QemuSpiceKbd {
35 SpiceKbdInstance sin;
36 int ledstate;
37 bool emul0;
35} QemuSpiceKbd;
36
37static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag);
38static uint8_t kbd_get_leds(SpiceKbdInstance *sin);
39static void kbd_leds(void *opaque, int l);
40
41static const SpiceKbdInterface kbd_interface = {
42 .base.type = SPICE_INTERFACE_KEYBOARD,
43 .base.description = "qemu keyboard",
44 .base.major_version = SPICE_INTERFACE_KEYBOARD_MAJOR,
45 .base.minor_version = SPICE_INTERFACE_KEYBOARD_MINOR,
46 .push_scan_freg = kbd_push_key,
47 .get_leds = kbd_get_leds,
48};
49
38} QemuSpiceKbd;
39
40static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag);
41static uint8_t kbd_get_leds(SpiceKbdInstance *sin);
42static void kbd_leds(void *opaque, int l);
43
44static const SpiceKbdInterface kbd_interface = {
45 .base.type = SPICE_INTERFACE_KEYBOARD,
46 .base.description = "qemu keyboard",
47 .base.major_version = SPICE_INTERFACE_KEYBOARD_MAJOR,
48 .base.minor_version = SPICE_INTERFACE_KEYBOARD_MINOR,
49 .push_scan_freg = kbd_push_key,
50 .get_leds = kbd_get_leds,
51};
52
50static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
53static void kbd_push_key(SpiceKbdInstance *sin, uint8_t scancode)
51{
54{
52 kbd_put_keycode(frag);
55 QemuSpiceKbd *kbd = container_of(sin, QemuSpiceKbd, sin);
56 int keycode;
57 bool up;
58
59 if (scancode == SCANCODE_EMUL0) {
60 kbd->emul0 = true;
61 return;
62 }
63 keycode = scancode & ~SCANCODE_UP;
64 up = scancode & SCANCODE_UP;
65 if (kbd->emul0) {
66 kbd->emul0 = false;
67 keycode |= SCANCODE_GREY;
68 }
69
70 qemu_input_event_send_key_number(NULL, keycode, !up);
53}
54
55static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
56{
57 QemuSpiceKbd *kbd = container_of(sin, QemuSpiceKbd, sin);
58 return kbd->ledstate;
59}
60

--- 157 unchanged lines hidden ---
71}
72
73static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
74{
75 QemuSpiceKbd *kbd = container_of(sin, QemuSpiceKbd, sin);
76 return kbd->ledstate;
77}
78

--- 157 unchanged lines hidden ---