[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 41/44] input: move do_mouse_set to new core
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 41/44] input: move do_mouse_set to new core |
Date: |
Mon, 24 Feb 2014 12:52:48 +0100 |
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 <address@hidden>
---
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();
+}
--
1.8.3.1
- [Qemu-devel] [PATCH 07/44] input: qapi: add unmapped key, (continued)
- [Qemu-devel] [PATCH 07/44] input: qapi: add unmapped key, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 29/44] input: keyboard: switch cocoa ui to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 06/44] input: qapi: define event types, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 15/44] sdl2: switch keyboard handling to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 19/44] input: mouse: add helpers functions to core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 17/44] input: keyboard: switch spice ui to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 31/44] input: trace events, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 16/44] input: keyboard: switch vnc ui to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 36/44] input: move mouse mode notifier to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 28/44] input: mouse: switch monitor to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 41/44] input: move do_mouse_set to new core,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 43/44] console: add head to index to qemu consoles., Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 03/44] sdl2: remove text console logic, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 13/44] input: keyboard: switch gtk ui to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 12/44] input: keyboard: switch qmp_send_key() to new core., Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 23/44] input: mouse: switch gtk ui to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 37/44] input: add input_mouse_mode tracepoint, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 22/44] input: mouse: switch legacy handlers to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 20/44] input: mouse: add graphic_rotate support, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 44/44] console: add QemuUIInfo, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 38/44] sdl2: simplify keymap handling, Gerd Hoffmann, 2014/02/24