[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 4/5] spice: set pointer position on hotspot
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 4/5] spice: set pointer position on hotspot |
Date: |
Mon, 27 Apr 2015 13:07:05 +0200 |
From: Marc-André Lureau <address@hidden>
The Spice protocol uses cursor position on hotspot: the client is
applying hotspot offset when drawing the cursor.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
include/ui/spice-display.h | 3 ++-
ui/spice-display.c | 10 ++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h
index 53883a1..b25328a 100644
--- a/include/ui/spice-display.h
+++ b/include/ui/spice-display.h
@@ -97,7 +97,8 @@ struct SimpleSpiceDisplay {
/* cursor (without qxl): displaychangelistener -> spice server */
SimpleSpiceCursor *ptr_define;
SimpleSpiceCursor *ptr_move;
- uint16_t ptr_x, ptr_y;
+ int16_t ptr_x, ptr_y;
+ int16_t hot_x, hot_y;
/* cursor (with qxl): qxl local renderer -> displaychangelistener */
QEMUCursor *cursor;
diff --git a/ui/spice-display.c b/ui/spice-display.c
index bf66cc9..a09f6f8 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -275,8 +275,8 @@ qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd,
if (c) {
ccmd->type = QXL_CURSOR_SET;
- ccmd->u.set.position.x = ssd->ptr_x;
- ccmd->u.set.position.y = ssd->ptr_y;
+ ccmd->u.set.position.x = ssd->ptr_x + ssd->hot_x;
+ ccmd->u.set.position.y = ssd->ptr_y + ssd->hot_y;
ccmd->u.set.visible = true;
ccmd->u.set.shape = (uintptr_t)cursor;
cursor->header.unique = ssd->unique++;
@@ -290,8 +290,8 @@ qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd,
memcpy(cursor->chunk.data, c->data, size);
} else {
ccmd->type = QXL_CURSOR_MOVE;
- ccmd->u.position.x = ssd->ptr_x;
- ccmd->u.position.y = ssd->ptr_y;
+ ccmd->u.position.x = ssd->ptr_x + ssd->hot_x;
+ ccmd->u.position.y = ssd->ptr_y + ssd->hot_y;
}
ccmd->release_info.id = (uintptr_t)(&update->ext);
@@ -748,6 +748,8 @@ static void display_mouse_define(DisplayChangeListener *dcl,
SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
qemu_mutex_lock(&ssd->lock);
+ ssd->hot_x = c->hot_x;
+ ssd->hot_y = c->hot_y;
if (ssd->ptr_move) {
g_free(ssd->ptr_move);
ssd->ptr_move = NULL;
--
1.8.3.1
- [Qemu-devel] [PULL 0/5] spice patch queue., Gerd Hoffmann, 2015/04/27
- [Qemu-devel] [PULL 4/5] spice: set pointer position on hotspot,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 1/5] monitor: Make client_migrate_info synchronous, Gerd Hoffmann, 2015/04/27
- [Qemu-devel] [PULL 3/5] spice: fix mouse cursor position, Gerd Hoffmann, 2015/04/27
- [Qemu-devel] [PULL 5/5] spice: learn to hide cursor, Gerd Hoffmann, 2015/04/27
- [Qemu-devel] [PULL 2/5] spice: fix simple display on bigendian hosts, Gerd Hoffmann, 2015/04/27
- Re: [Qemu-devel] [PULL 0/5] spice patch queue., Peter Maydell, 2015/04/28