Skip to contentSkip to conversation

spice: add mouse cursor support

PATCH New Gerd Hoffmann 1 participant 1 message Jun 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spice: add mouse cursor support

So you'll have a mouse pointer when running non-qxl gfx cards with mouse pointer support (virtio-gpu, IIRC vmware too).

---
 hw/display/qxl.c           |   6 ++-
 include/ui/spice-display.h |  14 +++++
 ui/spice-display.c         | 129 +++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 137 insertions(+), 12 deletions(-)
hw/display/qxl.c +5 -1
index 7fb83e4..736fd3c 100644
@@ -710,7 +710,11 @@ static void interface_release_resource(QXLInstance *sin,
 
     if (ext.group_id == MEMSLOT_GROUP_HOST) {
         /* host group -> vga mode update request */
-        qemu_spice_destroy_update(&qxl->ssd, (void *)(intptr_t)ext.info->id);
+        QXLCommandExt *cmdext = (void *)(ext.info->id);
+        SimpleSpiceUpdate *update;
+        g_assert(cmdext->cmd.type == QXL_CMD_DRAW);
+        update = container_of(cmdext, SimpleSpiceUpdate, ext);
+        qemu_spice_destroy_update(&qxl->ssd, update);
         return;
     }
 
include/ui/spice-display.h +14 -0
index a46bc80..4252ab8 100644
@@ -69,6 +69,7 @@ QXLCookie *qxl_cookie_new(int type, uint64_t io);
 
 typedef struct SimpleSpiceDisplay SimpleSpiceDisplay;
 typedef struct SimpleSpiceUpdate SimpleSpiceUpdate;
+typedef struct SimpleSpiceCursor SimpleSpiceCursor;
 
 struct SimpleSpiceDisplay {
     DisplaySurface *ds;
@@ -92,6 +93,13 @@ struct SimpleSpiceDisplay {
      */
     QemuMutex lock;
     QTAILQ_HEAD(, SimpleSpiceUpdate) updates;
+
+    /* cursor (without qxl): displaychangelistener -> spice server */
+    SimpleSpiceCursor *ptr_define;
+    SimpleSpiceCursor *ptr_move;
+    uint16_t ptr_x, ptr_y;
+
+    /* cursor (with qxl): qxl local renderer -> displaychangelistener */
     QEMUCursor *cursor;
     int mouse_x, mouse_y;
 };
@@ -104,6 +112,12 @@ struct SimpleSpiceUpdate {
     QTAILQ_ENTRY(SimpleSpiceUpdate) next;
 };
 
+struct SimpleSpiceCursor {
+    QXLCursorCmd cmd;
+    QXLCommandExt ext;
+    QXLCursor cursor;
+};
+
 int qemu_spice_rect_is_empty(const QXLRect* r);
 void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r);
 
ui/spice-display.c +118 -11

162 lines not on this page · raw message

Signature · 1 line
1.8.3.1