From patchwork Fri Sep 9 13:40:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 114099 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1F047B6F93 for ; Fri, 9 Sep 2011 23:32:02 +1000 (EST) Received: from localhost ([::1]:58415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R21BX-0006Bg-9r for incoming@patchwork.ozlabs.org; Fri, 09 Sep 2011 09:31:59 -0400 Received: from eggs.gnu.org ([140.186.70.92]:40866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R21BO-00066E-KC for qemu-devel@nongnu.org; Fri, 09 Sep 2011 09:31:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R21BN-0000Sd-FC for qemu-devel@nongnu.org; Fri, 09 Sep 2011 09:31:50 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:29840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R21BN-0000OW-8J for qemu-devel@nongnu.org; Fri, 09 Sep 2011 09:31:49 -0400 X-IronPort-AV: E=Sophos;i="4.68,356,1312171200"; d="scan'208";a="162320085" Received: from ftlpmailmx02.citrite.net ([10.13.107.66]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/RC4-MD5; 09 Sep 2011 09:31:46 -0400 Received: from smtp01.ad.xensource.com (10.219.128.104) by smtprelay.citrix.com (10.13.107.66) with Microsoft SMTP Server id 8.3.137.0; Fri, 9 Sep 2011 09:31:45 -0400 Received: from localhost.localdomain (kaball.uk.xensource.com [10.80.2.59]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id p89DVfEb032174; Fri, 9 Sep 2011 06:31:44 -0700 From: To: qemu-devel@nongnu.org Date: Fri, 9 Sep 2011 14:40:07 +0100 Message-ID: <1315575609-30317-2-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: John Haxby , stefano.stabellini@eu.citrix.com Subject: [Qemu-devel] [PATCH 2/4] Move the xenfb pointer handler to the connected method 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 From: John Haxby Ensure that we read "request-abs-pointer" after the frontend has written it. This means that we will correctly set up an ansolute or relative pointer handler correctly. Signed-off-by: John Haxby Signed-off-by: Stefano Stabellini --- hw/xenfb.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/hw/xenfb.c b/hw/xenfb.c index c001ab9..a644727 100644 --- a/hw/xenfb.c +++ b/hw/xenfb.c @@ -356,10 +356,6 @@ static int input_initialise(struct XenDevice *xendev) struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); int rc; - if (xenstore_read_fe_int(xendev, "request-abs-pointer", - &in->abs_pointer_wanted) == -1) - in->abs_pointer_wanted = 0; - if (!in->c.ds) { char *vfb = xenstore_read_str(NULL, "device/vfb"); if (vfb == NULL) { @@ -377,10 +373,24 @@ static int input_initialise(struct XenDevice *xendev) return rc; qemu_add_kbd_event_handler(xenfb_key_event, in); + return 0; +} + +static void input_connected(struct XenDevice *xendev) +{ + struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); + + if (xenstore_read_fe_int(xendev, "request-abs-pointer", + &in->abs_pointer_wanted) == -1) { + in->abs_pointer_wanted = 0; + } + + if (in->qmouse) { + qemu_remove_mouse_event_handler(in->qmouse); + } in->qmouse = qemu_add_mouse_event_handler(xenfb_mouse_event, in, in->abs_pointer_wanted, "Xen PVFB Mouse"); - return 0; } static void input_disconnect(struct XenDevice *xendev) @@ -960,6 +970,7 @@ struct XenDevOps xen_kbdmouse_ops = { .size = sizeof(struct XenInput), .init = input_init, .initialise = input_initialise, + .connected = input_connected, .disconnect = input_disconnect, .event = input_event, };