Received: from eggs.gnu.org ([2001:4830:134:3::10]:52722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaS2K-00037W-Kf for qemu-devel@nongnu.org; Tue, 24 Mar 2015 12:50:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YaS2J-0005xA-KL for qemu-devel@nongnu.org; Tue, 24 Mar 2015 12:50:40 -0400 Received: from mail-qg0-x22e.google.com ([2607:f8b0:400d:c04::22e]:35920) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaS2J-0005wx-H4 for qemu-devel@nongnu.org; Tue, 24 Mar 2015 12:50:39 -0400 Received: by qgez102 with SMTP id z102so115823007qge.3 for ; Tue, 24 Mar 2015 09:50:39 -0700 (PDT) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 24 Mar 2015 17:50:12 +0100 Message-Id: <1427215813-2206-3-git-send-email-marcandre.lureau@gmail.com> In-Reply-To: <1427215813-2206-1-git-send-email-marcandre.lureau@gmail.com> References: <1427215813-2206-1-git-send-email-marcandre.lureau@gmail.com> Subject: [Qemu-devel] [PATCH 2/3] 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?= , kraxel@redhat.com 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