From patchwork Tue Mar 24 16:50:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 453956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BF4A314007F for ; Wed, 25 Mar 2015 03:52:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=oq28RV4O; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost ([::1]:33512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaS4W-0006ng-2E for incoming@patchwork.ozlabs.org; Tue, 24 Mar 2015 12:52:56 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bhxRyN0w/0HuvS6SGrq7HbzRWA8L4TRtwreB9g0AaPQ=; b=oq28RV4OM/WaBzpasJmBIrAlk1hSoWab+dwgG9XtilACHH9tteXGjzV9/0IaHBgnQp XlCV99i9WW71tnvc0wtx4Ql97Bq+tBlj6hQcbm8LM1Fw9P+thd5rtn6qtOF9/HxRMkRj GZ1w9TQsP5/nZpbhgc0Of7vT6bYrkiplH21nQMGhltiI8m7lxjcPgCIbo0O7LBIKasrp LAhIBL5wBSA9AHwAqdS1GeDPRUU/1DBu45j2rmoGEKGXHkkEZEWgsdKeKWH/KBIzol4B EWMU6tYm1Ewu5zmLxh5L8GBtn1D/urOlDaMomEkImIRcBPYewLe0lkN2iUhNPA+s5JCj h5Qw== X-Received: by 10.140.98.227 with SMTP id o90mr6697878qge.96.1427215826502; Tue, 24 Mar 2015 09:50:26 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by mx.google.com with ESMTPSA id t75sm3042958qgd.42.2015.03.24.09.50.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Mar 2015 09:50:25 -0700 (PDT) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 24 Mar 2015 17:50:12 +0100 Message-Id: <1427215813-2206-3-git-send-email-marcandre.lureau@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427215813-2206-1-git-send-email-marcandre.lureau@gmail.com> References: <1427215813-2206-1-git-send-email-marcandre.lureau@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c04::22e Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Subject: [Qemu-devel] [PATCH 2/3] spice: set pointer position on hotspot X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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;