mirror of https://github.com/xemu-project/xemu.git
ui: Split hmp_mouse_set() and move the HMP part to ui/
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230109190321.1056914-17-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
006e79cdf4
commit
ec843b97f2
|
@ -88,6 +88,7 @@ void hmp_getfd(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_closefd(Monitor *mon, const QDict *qdict);
|
void hmp_closefd(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_mouse_move(Monitor *mon, const QDict *qdict);
|
void hmp_mouse_move(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_mouse_button(Monitor *mon, const QDict *qdict);
|
void hmp_mouse_button(Monitor *mon, const QDict *qdict);
|
||||||
|
void hmp_mouse_set(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_sendkey(Monitor *mon, const QDict *qdict);
|
void hmp_sendkey(Monitor *mon, const QDict *qdict);
|
||||||
void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict);
|
void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
|
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
|
||||||
|
|
|
@ -65,7 +65,7 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry);
|
||||||
|
|
||||||
void kbd_put_ledstate(int ledstate);
|
void kbd_put_ledstate(int ledstate);
|
||||||
|
|
||||||
void hmp_mouse_set(Monitor *mon, const QDict *qdict);
|
bool qemu_mouse_set(int index, Error **errp);
|
||||||
|
|
||||||
/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
|
/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
|
||||||
constants) */
|
constants) */
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "ui/qemu-spice.h"
|
#include "ui/qemu-spice.h"
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
#include "qemu/ctype.h"
|
#include "qemu/ctype.h"
|
||||||
#include "ui/console.h"
|
|
||||||
#include "audio/audio.h"
|
#include "audio/audio.h"
|
||||||
#include "disas/disas.h"
|
#include "disas/disas.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
|
|
15
ui/input.c
15
ui/input.c
|
@ -2,8 +2,6 @@
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qapi/qapi-commands-ui.h"
|
#include "qapi/qapi-commands-ui.h"
|
||||||
#include "qapi/qmp/qdict.h"
|
|
||||||
#include "qemu/error-report.h"
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "ui/input.h"
|
#include "ui/input.h"
|
||||||
#include "ui/console.h"
|
#include "ui/console.h"
|
||||||
|
@ -594,10 +592,9 @@ MouseInfoList *qmp_query_mice(Error **errp)
|
||||||
return mice_list;
|
return mice_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hmp_mouse_set(Monitor *mon, const QDict *qdict)
|
bool qemu_mouse_set(int index, Error **errp)
|
||||||
{
|
{
|
||||||
QemuInputHandlerState *s;
|
QemuInputHandlerState *s;
|
||||||
int index = qdict_get_int(qdict, "index");
|
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
QTAILQ_FOREACH(s, &handlers, node) {
|
QTAILQ_FOREACH(s, &handlers, node) {
|
||||||
|
@ -606,8 +603,9 @@ void hmp_mouse_set(Monitor *mon, const QDict *qdict)
|
||||||
}
|
}
|
||||||
if (!(s->handler->mask & (INPUT_EVENT_MASK_REL |
|
if (!(s->handler->mask & (INPUT_EVENT_MASK_REL |
|
||||||
INPUT_EVENT_MASK_ABS))) {
|
INPUT_EVENT_MASK_ABS))) {
|
||||||
error_report("Input device '%s' is not a mouse", s->handler->name);
|
error_setg(errp, "Input device '%s' is not a mouse",
|
||||||
return;
|
s->handler->name);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
found = 1;
|
found = 1;
|
||||||
qemu_input_handler_activate(s);
|
qemu_input_handler_activate(s);
|
||||||
|
@ -615,9 +613,10 @@ void hmp_mouse_set(Monitor *mon, const QDict *qdict)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
error_report("Mouse at index '%d' not found", index);
|
error_setg(errp, "Mouse at index '%d' not found", index);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_input_check_mode_change();
|
qemu_input_check_mode_change();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,14 @@ void hmp_mouse_button(Monitor *mon, const QDict *qdict)
|
||||||
mouse_button_state = button_state;
|
mouse_button_state = button_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hmp_mouse_set(Monitor *mon, const QDict *qdict)
|
||||||
|
{
|
||||||
|
Error *err = NULL;
|
||||||
|
|
||||||
|
qemu_mouse_set(qdict_get_int(qdict, "index"), &err);
|
||||||
|
hmp_handle_error(mon, err);
|
||||||
|
}
|
||||||
|
|
||||||
void hmp_info_mice(Monitor *mon, const QDict *qdict)
|
void hmp_info_mice(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
MouseInfoList *mice_list, *mouse;
|
MouseInfoList *mice_list, *mouse;
|
||||||
|
|
Loading…
Reference in New Issue