From patchwork Wed Mar 10 16:51:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 47261 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 BB0B2B7CA6 for ; Thu, 11 Mar 2010 03:58:26 +1100 (EST) Received: from localhost ([127.0.0.1]:58847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpPEk-0002Ey-VJ for incoming@patchwork.ozlabs.org; Wed, 10 Mar 2010 11:58:22 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NpP8A-0004qJ-0m for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:34 -0500 Received: from [199.232.76.173] (port=58951 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpP88-0004oz-S6 for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:32 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NpP87-0001YJ-El for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:32 -0500 Received: from e32.co.us.ibm.com ([32.97.110.150]:59061) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NpP87-0001Y2-1P for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:31 -0500 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e32.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o2AGj12m020804 for ; Wed, 10 Mar 2010 09:45:01 -0700 Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o2AGpEZm020680 for ; Wed, 10 Mar 2010 09:51:17 -0700 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o2AGrcrh004847 for ; Wed, 10 Mar 2010 09:53:38 -0700 Received: from localhost.localdomain (dyn95341159.austin.ibm.com [9.53.41.159]) by d03av06.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o2AGrbGx004788; Wed, 10 Mar 2010 09:53:38 -0700 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Wed, 10 Mar 2010 10:51:05 -0600 Message-Id: <1268239869-16058-3-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> References: <1268239869-16058-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: 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;