[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RfC PATCH 05/11] spice: add mouse
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [RfC PATCH 05/11] spice: add mouse |
Date: |
Wed, 14 Apr 2010 11:55:16 +0200 |
Open mouse channel. Now you can move the guests mouse pointer.
No tablet / absolute positioning (yet) though.
---
spice-input.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/spice-input.c b/spice-input.c
index e05f300..c22ab53 100644
--- a/spice-input.c
+++ b/spice-input.c
@@ -46,12 +46,43 @@ static void kbd_leds(void *opaque, int ledstate)
spice_server_kbd_leds(&kbd->sin, ledstate);
}
+/* mouse bits */
+
+typedef struct QemuSpiceMouse {
+ SpiceMouseInstance sin;
+} QemuSpiceMouse;
+
+static void mouse_motion(SpiceMouseInstance *sin, int dx, int dy, int dz,
+ uint32_t buttons_state)
+{
+ kbd_mouse_event(dx, dy, dz, buttons_state);
+}
+
+static void mouse_buttons(SpiceMouseInstance *sin, uint32_t buttons_state)
+{
+ kbd_mouse_event(0, 0, 0, buttons_state);
+}
+
+static SpiceMouseInterface mouse_interface = {
+ .base.type = SPICE_INTERFACE_MOUSE,
+ .base.description = "mouse",
+ .base.major_version = SPICE_INTERFACE_MOUSE_MAJOR,
+ .base.minor_version = SPICE_INTERFACE_MOUSE_MINOR,
+ .motion = mouse_motion,
+ .buttons = mouse_buttons,
+};
+
void qemu_spice_input_init(void)
{
QemuSpiceKbd *kbd;
+ QemuSpiceMouse *mouse;
kbd = qemu_mallocz(sizeof(*kbd));
kbd->sin.base.sif = &kbd_interface.base;
spice_server_add_interface(spice_server, &kbd->sin.base);
qemu_add_led_event_handler(kbd_leds, kbd);
+
+ mouse = qemu_mallocz(sizeof(*mouse));
+ mouse->sin.base.sif = &mouse_interface.base;
+ spice_server_add_interface(spice_server, &mouse->sin.base);
}
--
1.6.6.1
- [Qemu-devel] [RfC PATCH 00/11] Add spice support to qemu., Gerd Hoffmann, 2010/04/14
- [Qemu-devel] [RfC PATCH 04/11] spice: add keyboard, Gerd Hoffmann, 2010/04/14
- [Qemu-devel] [RfC PATCH 02/11] add spice into the configure file, Gerd Hoffmann, 2010/04/14
- [Qemu-devel] [RfC PATCH 03/11] spice: core bits, Gerd Hoffmann, 2010/04/14
- [Qemu-devel] [RfC PATCH 05/11] spice: add mouse,
Gerd Hoffmann <=
- [Qemu-devel] [RfC PATCH 07/11] spice: tls support, Gerd Hoffmann, 2010/04/14
- [Qemu-devel] [RfC PATCH 01/11] vgabios update to 0.6c, add bios for qxl/unstable, Gerd Hoffmann, 2010/04/14
- [Qemu-devel] [RfC PATCH 10/11] spice: add tablet support, Gerd Hoffmann, 2010/04/14
- [Qemu-devel] [RfC PATCH 11/11] spice: add audio, Gerd Hoffmann, 2010/04/14
- Re: [Qemu-devel] [RfC PATCH 11/11] spice: add audio, Gerd Hoffmann, 2010/04/16