input: keyboard: switch spice ui to new core
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
8d447d10b7
commit
de8f580b23
@ -26,12 +26,15 @@
|
|||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "ui/qemu-spice.h"
|
#include "ui/qemu-spice.h"
|
||||||
#include "ui/console.h"
|
#include "ui/console.h"
|
||||||
|
#include "ui/keymaps.h"
|
||||||
|
#include "ui/input.h"
|
||||||
|
|
||||||
/* keyboard bits */
|
/* keyboard bits */
|
||||||
|
|
||||||
typedef struct QemuSpiceKbd {
|
typedef struct QemuSpiceKbd {
|
||||||
SpiceKbdInstance sin;
|
SpiceKbdInstance sin;
|
||||||
int ledstate;
|
int ledstate;
|
||||||
|
bool emul0;
|
||||||
} QemuSpiceKbd;
|
} QemuSpiceKbd;
|
||||||
|
|
||||||
static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag);
|
static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag);
|
||||||
@ -47,9 +50,24 @@ static const SpiceKbdInterface kbd_interface = {
|
|||||||
.get_leds = kbd_get_leds,
|
.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)
|
static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user