Received: from eggs.gnu.org ([2001:4830:134:3::10]:53865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ymgsh-0004G0-68 for qemu-devel@nongnu.org; Mon, 27 Apr 2015 07:07:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ymgsf-00046K-QI for qemu-devel@nongnu.org; Mon, 27 Apr 2015 07:07:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ymgsf-00045y-Ed for qemu-devel@nongnu.org; Mon, 27 Apr 2015 07:07:17 -0400 From: Gerd Hoffmann Date: Mon, 27 Apr 2015 13:07:05 +0200 Message-Id: <1430132826-1121-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1430132826-1121-1-git-send-email-kraxel@redhat.com> References: <1430132826-1121-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 4/5] spice: set pointer position on hotspot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann From: Marc-Andr=C3=A9 Lureau The Spice protocol uses cursor position on hotspot: the client is applying hotspot offset when drawing the cursor. Signed-off-by: Gerd Hoffmann --- 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; =20 /* 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 *s= sd, =20 if (c) { ccmd->type =3D QXL_CURSOR_SET; - ccmd->u.set.position.x =3D ssd->ptr_x; - ccmd->u.set.position.y =3D ssd->ptr_y; + ccmd->u.set.position.x =3D ssd->ptr_x + ssd->hot_x; + ccmd->u.set.position.y =3D ssd->ptr_y + ssd->hot_y; ccmd->u.set.visible =3D true; ccmd->u.set.shape =3D (uintptr_t)cursor; cursor->header.unique =3D ssd->unique++; @@ -290,8 +290,8 @@ qemu_spice_create_cursor_update(SimpleSpiceDisplay *s= sd, memcpy(cursor->chunk.data, c->data, size); } else { ccmd->type =3D QXL_CURSOR_MOVE; - ccmd->u.position.x =3D ssd->ptr_x; - ccmd->u.position.y =3D ssd->ptr_y; + ccmd->u.position.x =3D ssd->ptr_x + ssd->hot_x; + ccmd->u.position.y =3D ssd->ptr_y + ssd->hot_y; } ccmd->release_info.id =3D (uintptr_t)(&update->ext); =20 @@ -748,6 +748,8 @@ static void display_mouse_define(DisplayChangeListene= r *dcl, SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dc= l); =20 qemu_mutex_lock(&ssd->lock); + ssd->hot_x =3D c->hot_x; + ssd->hot_y =3D c->hot_y; if (ssd->ptr_move) { g_free(ssd->ptr_move); ssd->ptr_move =3D NULL; --=20 1.8.3.1