* [Qemu-devel] [PATCH 0/3] A few Spice cursor fixes for non-QXL
@ 2015-03-24 16:50 Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 1/3] spice: fix mouse cursor position Marc-André Lureau
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Marc-André Lureau @ 2015-03-24 16:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau, kraxel
Hi
Since 5643fc0, qemu learned to set Spice cursor when using
non-QXL card, this is a few improvements:
Marc-André Lureau (3):
spice: fix mouse cursor position
spice: set pointer position on hotspot
spice: learn to hide cursor
include/ui/spice-display.h | 3 ++-
ui/spice-display.c | 21 +++++++++++++--------
2 files changed, 15 insertions(+), 9 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 1/3] spice: fix mouse cursor position
2015-03-24 16:50 [Qemu-devel] [PATCH 0/3] A few Spice cursor fixes for non-QXL Marc-André Lureau
@ 2015-03-24 16:50 ` Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 2/3] spice: set pointer position on hotspot Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 3/3] spice: learn to hide cursor Marc-André Lureau
2 siblings, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2015-03-24 16:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau, kraxel
---
ui/spice-display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/spice-display.c b/ui/spice-display.c
index c888650..fb22b65 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -717,7 +717,7 @@ static void display_mouse_set(DisplayChangeListener *dcl,
qemu_mutex_lock(&ssd->lock);
ssd->ptr_x = x;
- ssd->ptr_y = x;
+ ssd->ptr_y = y;
if (ssd->ptr_move) {
g_free(ssd->ptr_move);
}
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/3] spice: set pointer position on hotspot
2015-03-24 16:50 [Qemu-devel] [PATCH 0/3] A few Spice cursor fixes for non-QXL Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 1/3] spice: fix mouse cursor position Marc-André Lureau
@ 2015-03-24 16:50 ` Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 3/3] spice: learn to hide cursor Marc-André Lureau
2 siblings, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2015-03-24 16:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau, kraxel
The Spice protocol uses cursor position on hotspot: the client is
applying hotspot offset when drawing the cursor.
---
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 1672889..2c3959f 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 fb22b65..a85d6aa 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -284,8 +284,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++;
@@ -299,8 +299,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);
@@ -731,6 +731,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;
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 3/3] spice: learn to hide cursor
2015-03-24 16:50 [Qemu-devel] [PATCH 0/3] A few Spice cursor fixes for non-QXL Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 1/3] spice: fix mouse cursor position Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 2/3] spice: set pointer position on hotspot Marc-André Lureau
@ 2015-03-24 16:50 ` Marc-André Lureau
2 siblings, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2015-03-24 16:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau, kraxel
---
ui/spice-display.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/ui/spice-display.c b/ui/spice-display.c
index a85d6aa..7d025be 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -269,7 +269,8 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
static SimpleSpiceCursor*
qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd,
- QEMUCursor *c)
+ QEMUCursor *c,
+ int on)
{
size_t size = c ? c->width * c->height * 4 : 0;
SimpleSpiceCursor *update;
@@ -297,6 +298,8 @@ qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd,
cursor->data_size = size;
cursor->chunk.data_size = size;
memcpy(cursor->chunk.data, c->data, size);
+ } else if (!on) {
+ ccmd->type = QXL_CURSOR_HIDE;
} else {
ccmd->type = QXL_CURSOR_MOVE;
ccmd->u.position.x = ssd->ptr_x + ssd->hot_x;
@@ -721,7 +724,7 @@ static void display_mouse_set(DisplayChangeListener *dcl,
if (ssd->ptr_move) {
g_free(ssd->ptr_move);
}
- ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL);
+ ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL, on);
qemu_mutex_unlock(&ssd->lock);
}
@@ -740,7 +743,7 @@ static void display_mouse_define(DisplayChangeListener *dcl,
if (ssd->ptr_define) {
g_free(ssd->ptr_define);
}
- ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c);
+ ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, 0);
qemu_mutex_unlock(&ssd->lock);
}
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-24 16:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 16:50 [Qemu-devel] [PATCH 0/3] A few Spice cursor fixes for non-QXL Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 1/3] spice: fix mouse cursor position Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 2/3] spice: set pointer position on hotspot Marc-André Lureau
2015-03-24 16:50 ` [Qemu-devel] [PATCH 3/3] spice: learn to hide cursor Marc-André Lureau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).