From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NpP89-0004ph-E7 for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:33 -0500 Received: from [199.232.76.173] (port=58950 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpP88-0004ox-Rn 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-0001YQ-GG for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:32 -0500 Received: from e38.co.us.ibm.com ([32.97.110.159]:48691) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NpP87-0001Y4-3J for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:31 -0500 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e38.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o2AGjjhl030508 for ; Wed, 10 Mar 2010 09:45:45 -0700 Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o2AGpM65242518 for ; Wed, 10 Mar 2010 09:51:24 -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 o2AGrdha004892 for ; Wed, 10 Mar 2010 09:53:39 -0700 From: Anthony Liguori Date: Wed, 10 Mar 2010 10:51:07 -0600 Message-Id: <1268239869-16058-5-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 5/7] Expose whether a mouse is an absolute device via QMP and the human monitor. 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 For QMP, we just add an attribute which is backwards compatible. For the human monitor, we add (absolute) to the end of the line. Signed-off-by: Anthony Liguori --- input.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/input.c b/input.c index cbf55b7..d2a6f26 100644 --- a/input.c +++ b/input.c @@ -195,9 +195,10 @@ static void info_mice_iter(QObject *data, void *opaque) Monitor *mon = opaque; mouse = qobject_to_qdict(data); - monitor_printf(mon, "%c Mouse #%" PRId64 ": %s\n", + monitor_printf(mon, "%c Mouse #%" PRId64 ": %s%s\n", (qdict_get_bool(mouse, "current") ? '*' : ' '), - qdict_get_int(mouse, "index"), qdict_get_str(mouse, "name")); + qdict_get_int(mouse, "index"), qdict_get_str(mouse, "name"), + qdict_get_bool(mouse, "absolute") ? " (absolute)" : ""); } void do_info_mice_print(Monitor *mon, const QObject *data) @@ -224,11 +225,12 @@ void do_info_mice_print(Monitor *mon, const QObject *data) * - "name": mouse's name * - "index": mouse's index * - "current": true if this mouse is receiving events, false otherwise + * - "absolute": true if the mouse generates absolute input events * * Example: * - * [ { "name": "QEMU Microsoft Mouse", "index": 0, "current": false }, - * { "name": "QEMU PS/2 Mouse", "index": 1, "current": true } ] + * [ { "name": "QEMU Microsoft Mouse", "index": 0, "current": false, "absolute": false }, + * { "name": "QEMU PS/2 Mouse", "index": 1, "current": true, "absolute": true } ] */ void do_info_mice(Monitor *mon, QObject **ret_data) { @@ -246,10 +248,14 @@ void do_info_mice(Monitor *mon, QObject **ret_data) QTAILQ_FOREACH(cursor, &mouse_handlers, node) { QObject *obj; - obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }", + obj = qobject_from_jsonf("{ 'name': %s," + " 'index': %d," + " 'current': %i," + " 'absolute': %i }", cursor->qemu_put_mouse_event_name, cursor->index, - cursor->index == current); + cursor->index == current, + !!cursor->qemu_put_mouse_event_absolute); qlist_append_obj(mice_list, obj); } -- 1.6.5.2