From patchwork Mon Mar 15 20:34:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 47786 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 51719B7D93 for ; Tue, 16 Mar 2010 08:08:31 +1100 (EST) Received: from localhost ([127.0.0.1]:44528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrH4a-00065n-Vm for incoming@patchwork.ozlabs.org; Mon, 15 Mar 2010 16:39:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrGzn-000506-QG for qemu-devel@nongnu.org; Mon, 15 Mar 2010 16:34:39 -0400 Received: from [199.232.76.173] (port=53561 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrGzn-0004zt-C4 for qemu-devel@nongnu.org; Mon, 15 Mar 2010 16:34:39 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NrGzl-0008WT-7p for qemu-devel@nongnu.org; Mon, 15 Mar 2010 16:34:39 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]:46428) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NrGzk-0008WI-Vz for qemu-devel@nongnu.org; Mon, 15 Mar 2010 16:34:37 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e5.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id o2FKKNAL016666 for ; Mon, 15 Mar 2010 16:20:23 -0400 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o2FKYZ4A130452 for ; Mon, 15 Mar 2010 16:34:35 -0400 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o2FKYYtV025296 for ; Mon, 15 Mar 2010 14:34:34 -0600 Received: from localhost.localdomain (sig-9-65-105-148.mts.ibm.com [9.65.105.148]) by d03av01.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o2FKYTds024992; Mon, 15 Mar 2010 14:34:33 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Mon, 15 Mar 2010 15:34:24 -0500 Message-Id: <1268685268-16881-3-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: <1268685268-16881-1-git-send-email-aliguori@us.ibm.com> References: <1268685268-16881-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Avi Kivity , Anthony Liguori , Gerd Hoffman , Luiz Capitulino Subject: [Qemu-devel] [PATCH 3/7] Add kbd_mouse_has_absolute() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org kbd_mouse_is_absolute tells us whether the current mouse handler is an absolute device. kbd_mouse_has_absolute tells us whether we have any device that is capable of absolute input. This lets us tell a user that they have configured an absolute device but that the guest is not currently using it. Signed-off-by: Anthony Liguori --- console.h | 5 +++++ input.c | 13 +++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/console.h b/console.h index 94d9cae..f3c619f 100644 --- a/console.h +++ b/console.h @@ -53,8 +53,13 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry); void kbd_put_keycode(int keycode); void kbd_put_ledstate(int ledstate); void kbd_mouse_event(int dx, int dy, int dz, int buttons_state); + +/* Does the current mouse generate absolute events */ int kbd_mouse_is_absolute(void); +/* Of all the mice, is there one that generates absolute events */ +int kbd_mouse_has_absolute(void); + struct MouseTransformInfo { /* Touchscreen resolution */ int x; diff --git a/input.c b/input.c index 397bfc5..8d5a14d 100644 --- a/input.c +++ b/input.c @@ -153,6 +153,19 @@ int kbd_mouse_is_absolute(void) return QTAILQ_FIRST(&mouse_handlers)->qemu_put_mouse_event_absolute; } +int kbd_mouse_has_absolute(void) +{ + QEMUPutMouseEntry *entry; + + QTAILQ_FOREACH(entry, &mouse_handlers, node) { + if (entry->qemu_put_mouse_event_absolute) { + return 1; + } + } + + return 0; +} + static void info_mice_iter(QObject *data, void *opaque) { QDict *mouse;