Blame 0006-spice-add-mouse.patch

Justin M. Forbes a81953
From e18846175191cbc590ac46fa3820726aeebd6d48 Mon Sep 17 00:00:00 2001
Justin M. Forbes a81953
From: Gerd Hoffmann <kraxel@redhat.com>
Justin M. Forbes a81953
Date: Thu, 11 Mar 2010 11:13:29 -0300
Justin M. Forbes a81953
Subject: [PATCH 06/39] spice: add mouse
Justin M. Forbes a81953
Justin M. Forbes a81953
Open mouse channel.  Now you can move the guests mouse pointer.
Justin M. Forbes a81953
No tablet / absolute positioning (yet) though.
Justin M. Forbes a81953
---
Justin M. Forbes a81953
 spice-input.c |   31 +++++++++++++++++++++++++++++++
Justin M. Forbes a81953
 1 files changed, 31 insertions(+), 0 deletions(-)
Justin M. Forbes a81953
Justin M. Forbes a81953
diff --git a/spice-input.c b/spice-input.c
Justin M. Forbes a81953
index e1014d7..8f3deb4 100644
Justin M. Forbes a81953
--- a/spice-input.c
Justin M. Forbes a81953
+++ b/spice-input.c
Justin M. Forbes a81953
@@ -46,12 +46,43 @@ static void kbd_leds(void *opaque, int ledstate)
Justin M. Forbes a81953
     spice_server_kbd_leds(&kbd->sin, ledstate);
Justin M. Forbes a81953
 }
Justin M. Forbes a81953
Justin M. Forbes a81953
+/* mouse bits */
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+typedef struct QemuSpiceMouse {
Justin M. Forbes a81953
+    SpiceMouseInstance sin;
Justin M. Forbes a81953
+} QemuSpiceMouse;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static void mouse_motion(SpiceMouseInstance *sin, int dx, int dy, int dz,
Justin M. Forbes a81953
+                         uint32_t buttons_state)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    kbd_mouse_event(dx, dy, dz, buttons_state);
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static void mouse_buttons(SpiceMouseInstance *sin, uint32_t buttons_state)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    kbd_mouse_event(0, 0, 0, buttons_state);
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static const SpiceMouseInterface mouse_interface = {
Justin M. Forbes a81953
+    .base.type          = SPICE_INTERFACE_MOUSE,
Justin M. Forbes a81953
+    .base.description   = "mouse",
Justin M. Forbes a81953
+    .base.major_version = SPICE_INTERFACE_MOUSE_MAJOR,
Justin M. Forbes a81953
+    .base.minor_version = SPICE_INTERFACE_MOUSE_MINOR,
Justin M. Forbes a81953
+    .motion             = mouse_motion,
Justin M. Forbes a81953
+    .buttons            = mouse_buttons,
Justin M. Forbes a81953
+};
Justin M. Forbes a81953
+
Justin M. Forbes a81953
 void qemu_spice_input_init(void)
Justin M. Forbes a81953
 {
Justin M. Forbes a81953
     QemuSpiceKbd *kbd;
Justin M. Forbes a81953
+    QemuSpiceMouse *mouse;
Justin M. Forbes a81953
Justin M. Forbes a81953
     kbd = qemu_mallocz(sizeof(*kbd));
Justin M. Forbes a81953
     kbd->sin.base.sif = &kbd_interface.base;
Justin M. Forbes a81953
     spice_server_add_interface(spice_server, &kbd->sin.base);
Justin M. Forbes a81953
     qemu_add_led_event_handler(kbd_leds, kbd);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    mouse = qemu_mallocz(sizeof(*mouse));
Justin M. Forbes a81953
+    mouse->sin.base.sif = &mouse_interface.base;
Justin M. Forbes a81953
+    spice_server_add_interface(spice_server, &mouse->sin.base);
Justin M. Forbes a81953
 }
Justin M. Forbes a81953
-- 
Justin M. Forbes a81953
1.7.2.3
Justin M. Forbes a81953