From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NpjB7-0008Jm-GU for qemu-devel@nongnu.org; Thu, 11 Mar 2010 09:15:57 -0500 Received: from [199.232.76.173] (port=58085 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpjB7-0008Jb-1e for qemu-devel@nongnu.org; Thu, 11 Mar 2010 09:15:57 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NpjB5-0004T8-PW for qemu-devel@nongnu.org; Thu, 11 Mar 2010 09:15:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21200) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NpjB5-0004Sy-BV for qemu-devel@nongnu.org; Thu, 11 Mar 2010 09:15:55 -0500 Date: Thu, 11 Mar 2010 11:15:47 -0300 From: Luiz Capitulino Message-ID: <20100311111547.0a79a593@redhat.com> In-Reply-To: <1268239869-16058-5-git-send-email-aliguori@us.ibm.com> References: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> <1268239869-16058-5-git-send-email-aliguori@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [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: Anthony Liguori Cc: qemu-devel@nongnu.org, Gerd Hoffman On Wed, 10 Mar 2010 10:51:07 -0600 Anthony Liguori wrote: > 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 Looks good to me. > --- > 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); > } >