From patchwork Mon Feb 24 11:52:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 323632 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8ACB82C0228 for ; Mon, 24 Feb 2014 23:57:04 +1100 (EST) Received: from localhost ([::1]:57016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHuHr-0001nJ-O8 for incoming@patchwork.ozlabs.org; Mon, 24 Feb 2014 07:05:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHu69-0001aX-9c for qemu-devel@nongnu.org; Mon, 24 Feb 2014 06:53:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHu62-00011Y-Og for qemu-devel@nongnu.org; Mon, 24 Feb 2014 06:53:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHu62-00010Y-EY for qemu-devel@nongnu.org; Mon, 24 Feb 2014 06:53:18 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1OBrF60024742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 Feb 2014 06:53:16 -0500 Received: from nilsson.home.kraxel.org (vpn1-7-97.ams2.redhat.com [10.36.7.97]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s1OBr9sh018324; Mon, 24 Feb 2014 06:53:13 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id A1FD1805E7; Mon, 24 Feb 2014 12:53:09 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 24 Feb 2014 12:52:48 +0100 Message-Id: <1393242771-28076-42-git-send-email-kraxel@redhat.com> In-Reply-To: <1393242771-28076-1-git-send-email-kraxel@redhat.com> References: <1393242771-28076-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann , Anthony Liguori Subject: [Qemu-devel] [PATCH 41/44] input: move do_mouse_set to new core X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This removes the last user of the lecagy input mouse handler list, so we can remove more legacy bits with this. Signed-off-by: Gerd Hoffmann --- ui/input-legacy.c | 43 ------------------------------------------- ui/input.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 43 deletions(-) diff --git a/ui/input-legacy.c b/ui/input-legacy.c index 7843482..b51e6ad 100644 --- a/ui/input-legacy.c +++ b/ui/input-legacy.c @@ -35,12 +35,6 @@ struct QEMUPutMouseEntry { QEMUPutMouseEvent *qemu_put_mouse_event; void *qemu_put_mouse_event_opaque; int qemu_put_mouse_event_absolute; - char *qemu_put_mouse_event_name; - - int index; - - /* used internally by qemu for handling mice */ - QTAILQ_ENTRY(QEMUPutMouseEntry) node; /* new input core */ QemuInputHandler h; @@ -412,17 +406,12 @@ QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, const char *name) { QEMUPutMouseEntry *s; - static int mouse_index = 0; s = g_malloc0(sizeof(QEMUPutMouseEntry)); s->qemu_put_mouse_event = func; s->qemu_put_mouse_event_opaque = opaque; s->qemu_put_mouse_event_absolute = absolute; - s->qemu_put_mouse_event_name = g_strdup(name); - s->index = mouse_index++; - - QTAILQ_INSERT_TAIL(&mouse_handlers, s, node); s->h.name = name; s->h.mask = INPUT_EVENT_MASK_BTN | @@ -437,19 +426,13 @@ QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void qemu_activate_mouse_event_handler(QEMUPutMouseEntry *entry) { - QTAILQ_REMOVE(&mouse_handlers, entry, node); - QTAILQ_INSERT_HEAD(&mouse_handlers, entry, node); - qemu_input_handler_activate(entry->s); } void qemu_remove_mouse_event_handler(QEMUPutMouseEntry *entry) { - QTAILQ_REMOVE(&mouse_handlers, entry, node); - qemu_input_handler_unregister(entry->s); - g_free(entry->qemu_put_mouse_event_name); g_free(entry); } @@ -482,29 +465,3 @@ void kbd_put_ledstate(int ledstate) cursor->put_led(cursor->opaque, ledstate); } } - -void do_mouse_set(Monitor *mon, const QDict *qdict) -{ - QEMUPutMouseEntry *cursor; - int index = qdict_get_int(qdict, "index"); - int found = 0; - - if (QTAILQ_EMPTY(&mouse_handlers)) { - monitor_printf(mon, "No mouse devices connected\n"); - return; - } - - QTAILQ_FOREACH(cursor, &mouse_handlers, node) { - if (cursor->index == index) { - found = 1; - qemu_activate_mouse_event_handler(cursor); - break; - } - } - - if (!found) { - monitor_printf(mon, "Mouse at given index not found\n"); - } - - qemu_input_check_mode_change(); -} diff --git a/ui/input.c b/ui/input.c index 2945a3c..575c50e 100644 --- a/ui/input.c +++ b/ui/input.c @@ -336,3 +336,24 @@ MouseInfoList *qmp_query_mice(Error **errp) return mice_list; } + +void do_mouse_set(Monitor *mon, const QDict *qdict) +{ + QemuInputHandlerState *s; + int index = qdict_get_int(qdict, "index"); + int found = 0; + + QTAILQ_FOREACH(s, &handlers, node) { + if (s->id == index) { + found = 1; + qemu_input_handler_activate(s); + break; + } + } + + if (!found) { + monitor_printf(mon, "Mouse at given index not found\n"); + } + + qemu_input_check_mode_change(); +}