From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Anthony Liguori Date: Wed, 10 Mar 2010 10:51:05 -0600 Message-Id: <1268239869-16058-3-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> References: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 3/7] Add kbd_mouse_has_absolute() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Gerd Hoffman , Luiz Capitulino 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; -- 1.6.5.2