From patchwork Mon Mar 10 08:23:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 328501 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 319F02C009C for ; Mon, 10 Mar 2014 19:25:50 +1100 (EST) Received: from localhost ([::1]:47397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMvWu-0002aQ-2i for incoming@patchwork.ozlabs.org; Mon, 10 Mar 2014 04:25:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMvWN-0002ZM-QS for qemu-devel@nongnu.org; Mon, 10 Mar 2014 04:25:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMvWH-0007Qr-RU for qemu-devel@nongnu.org; Mon, 10 Mar 2014 04:25:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMvWH-0007QS-JB for qemu-devel@nongnu.org; Mon, 10 Mar 2014 04:25:09 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2A8O8GB025539 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Mar 2014 04:24:08 -0400 Received: from nilsson.home.kraxel.org (vpn1-5-44.ams2.redhat.com [10.36.5.44]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2A8O7UL009299; Mon, 10 Mar 2014 04:24:07 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id AEA6180BDB; Mon, 10 Mar 2014 09:24:05 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 10 Mar 2014 09:23:57 +0100 Message-Id: <1394439837-10021-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann , Anthony Liguori Subject: [Qemu-devel] [PATCH] input: sdl: fix guest_cursor logic. 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 Unbreaks relative mouse mode with SDL. Reported-by: Gabriel L. Somlo Signed-off-by: Gerd Hoffmann --- ui/sdl.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ui/sdl.c b/ui/sdl.c index c1a16be..4e7f920 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -455,13 +455,17 @@ static void sdl_send_mouse_event(int dx, int dy, int x, int y, int state) real_screen->w); qemu_input_queue_abs(dcl->con, INPUT_AXIS_Y, y, real_screen->h); - } else if (guest_cursor) { - x -= guest_x; - y -= guest_y; - guest_x += x; - guest_y += y; - qemu_input_queue_rel(dcl->con, INPUT_AXIS_X, x); - qemu_input_queue_rel(dcl->con, INPUT_AXIS_Y, y); + } else { + if (guest_cursor) { + x -= guest_x; + y -= guest_y; + guest_x += x; + guest_y += y; + dx = x; + dy = y; + } + qemu_input_queue_rel(dcl->con, INPUT_AXIS_X, dx); + qemu_input_queue_rel(dcl->con, INPUT_AXIS_Y, dy); } qemu_input_event_sync(); }