From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com, dgilbert@redhat.com, berrange@redhat.com,
philmd@linaro.org
Subject: [PATCH v3 12/18] ui: Move more HMP commands from monitor to ui/
Date: Tue, 20 Dec 2022 10:06:39 +0100 [thread overview]
Message-ID: <20221220090645.2844881-13-armbru@redhat.com> (raw)
In-Reply-To: <20221220090645.2844881-1-armbru@redhat.com>
This moves these commands from MAINTAINERS section "Human
Monitor (HMP)" to "Graphics".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
include/monitor/hmp.h | 2 ++
monitor/misc.c | 66 -------------------------------------------
ui/ui-hmp-cmds.c | 66 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 68 insertions(+), 66 deletions(-)
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index 27f86399f7..b228a406f3 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -81,6 +81,8 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict);
void hmp_netdev_del(Monitor *mon, const QDict *qdict);
void hmp_getfd(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_button(Monitor *mon, const QDict *qdict);
void hmp_sendkey(Monitor *mon, const QDict *qdict);
void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict);
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
diff --git a/monitor/misc.c b/monitor/misc.c
index bf3f1c67ca..3d68940d28 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -34,7 +34,6 @@
#include "qemu/config-file.h"
#include "qemu/ctype.h"
#include "ui/console.h"
-#include "ui/input.h"
#include "audio/audio.h"
#include "disas/disas.h"
#include "qemu/timer.h"
@@ -825,49 +824,6 @@ static void hmp_sum(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "%05d\n", sum);
}
-static int mouse_button_state;
-
-static void hmp_mouse_move(Monitor *mon, const QDict *qdict)
-{
- int dx, dy, dz, button;
- const char *dx_str = qdict_get_str(qdict, "dx_str");
- const char *dy_str = qdict_get_str(qdict, "dy_str");
- const char *dz_str = qdict_get_try_str(qdict, "dz_str");
-
- dx = strtol(dx_str, NULL, 0);
- dy = strtol(dy_str, NULL, 0);
- qemu_input_queue_rel(NULL, INPUT_AXIS_X, dx);
- qemu_input_queue_rel(NULL, INPUT_AXIS_Y, dy);
-
- if (dz_str) {
- dz = strtol(dz_str, NULL, 0);
- if (dz != 0) {
- button = (dz > 0) ? INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN;
- qemu_input_queue_btn(NULL, button, true);
- qemu_input_event_sync();
- qemu_input_queue_btn(NULL, button, false);
- }
- }
- qemu_input_event_sync();
-}
-
-static void hmp_mouse_button(Monitor *mon, const QDict *qdict)
-{
- static uint32_t bmap[INPUT_BUTTON__MAX] = {
- [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON,
- [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON,
- [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON,
- };
- int button_state = qdict_get_int(qdict, "button_state");
-
- if (mouse_button_state == button_state) {
- return;
- }
- qemu_input_update_buttons(NULL, bmap, mouse_button_state, button_state);
- qemu_input_event_sync();
- mouse_button_state = button_state;
-}
-
static void hmp_ioport_read(Monitor *mon, const QDict *qdict)
{
int size = qdict_get_int(qdict, "size");
@@ -1700,28 +1656,6 @@ void object_del_completion(ReadLineState *rs, int nb_args, const char *str)
qapi_free_ObjectPropertyInfoList(start);
}
-void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
-{
- int i;
- char *sep;
- size_t len;
-
- if (nb_args != 2) {
- return;
- }
- sep = strrchr(str, '-');
- if (sep) {
- str = sep + 1;
- }
- len = strlen(str);
- readline_set_completion_index(rs, len);
- for (i = 0; i < Q_KEY_CODE__MAX; i++) {
- if (!strncmp(str, QKeyCode_str(i), len)) {
- readline_add_completion(rs, QKeyCode_str(i));
- }
- }
-}
-
void set_link_completion(ReadLineState *rs, int nb_args, const char *str)
{
size_t len;
diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c
index aecd996968..95abd4693f 100644
--- a/ui/ui-hmp-cmds.c
+++ b/ui/ui-hmp-cmds.c
@@ -23,6 +23,50 @@
#include "qapi/qmp/qdict.h"
#include "qemu/cutils.h"
#include "ui/console.h"
+#include "ui/input.h"
+
+static int mouse_button_state;
+
+void hmp_mouse_move(Monitor *mon, const QDict *qdict)
+{
+ int dx, dy, dz, button;
+ const char *dx_str = qdict_get_str(qdict, "dx_str");
+ const char *dy_str = qdict_get_str(qdict, "dy_str");
+ const char *dz_str = qdict_get_try_str(qdict, "dz_str");
+
+ dx = strtol(dx_str, NULL, 0);
+ dy = strtol(dy_str, NULL, 0);
+ qemu_input_queue_rel(NULL, INPUT_AXIS_X, dx);
+ qemu_input_queue_rel(NULL, INPUT_AXIS_Y, dy);
+
+ if (dz_str) {
+ dz = strtol(dz_str, NULL, 0);
+ if (dz != 0) {
+ button = (dz > 0) ? INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN;
+ qemu_input_queue_btn(NULL, button, true);
+ qemu_input_event_sync();
+ qemu_input_queue_btn(NULL, button, false);
+ }
+ }
+ qemu_input_event_sync();
+}
+
+void hmp_mouse_button(Monitor *mon, const QDict *qdict)
+{
+ static uint32_t bmap[INPUT_BUTTON__MAX] = {
+ [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON,
+ [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON,
+ [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON,
+ };
+ int button_state = qdict_get_int(qdict, "button_state");
+
+ if (mouse_button_state == button_state) {
+ return;
+ }
+ qemu_input_update_buttons(NULL, bmap, mouse_button_state, button_state);
+ qemu_input_event_sync();
+ mouse_button_state = button_state;
+}
void hmp_info_mice(Monitor *mon, const QDict *qdict)
{
@@ -334,6 +378,28 @@ err_out:
goto out;
}
+void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
+{
+ int i;
+ char *sep;
+ size_t len;
+
+ if (nb_args != 2) {
+ return;
+ }
+ sep = strrchr(str, '-');
+ if (sep) {
+ str = sep + 1;
+ }
+ len = strlen(str);
+ readline_set_completion_index(rs, len);
+ for (i = 0; i < Q_KEY_CODE__MAX; i++) {
+ if (!strncmp(str, QKeyCode_str(i), len)) {
+ readline_add_completion(rs, QKeyCode_str(i));
+ }
+ }
+}
+
void coroutine_fn
hmp_screendump(Monitor *mon, const QDict *qdict)
{
--
2.38.1
next prev parent reply other threads:[~2022-12-20 9:42 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 9:06 [PATCH v3 00/18] ui: Move and clean up monitor command code Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 01/18] ui: Check numeric part of expire_password argument @time properly Markus Armbruster
2022-12-20 9:10 ` Daniel P. Berrangé
2022-12-20 9:06 ` [PATCH v3 02/18] ui: Fix silent truncation of numeric keys in HMP sendkey Markus Armbruster
2023-01-04 16:19 ` Dr. David Alan Gilbert
2023-01-09 11:50 ` Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 03/18] ui/spice: Require spice-protocol >= 0.14.0 Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 04/18] Revert "hmp: info spice: take out webdav" Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 05/18] ui/spice: Require spice-server >= 0.14.0 Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 06/18] ui/spice: QXLInterface method set_mm_time() is now dead, drop Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 07/18] ui/spice: Give hmp_info_spice()'s channel_names[] static linkage Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 08/18] ui: Clean up a few things checkpatch.pl would flag later on Markus Armbruster
2022-12-20 11:13 ` Philippe Mathieu-Daudé
2022-12-20 9:06 ` [PATCH v3 09/18] ui: Move QMP commands from monitor to new ui/ui-qmp-cmds.c Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 10/18] ui: Factor out qmp_add_client() parts and move to ui/ui-qmp-cmds.c Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 11/18] ui: Move HMP commands from monitor to new ui/ui-hmp-cmds.c Markus Armbruster
2022-12-20 9:06 ` Markus Armbruster [this message]
2022-12-20 9:11 ` [PATCH v3 12/18] ui: Move more HMP commands from monitor to ui/ Daniel P. Berrangé
2022-12-20 11:22 ` Philippe Mathieu-Daudé
2022-12-20 11:49 ` Markus Armbruster
2022-12-20 12:29 ` Philippe Mathieu-Daudé
2022-12-20 15:30 ` Markus Armbruster
2022-12-20 16:35 ` Philippe Mathieu-Daudé
2022-12-20 9:06 ` [PATCH v3 13/18] ui: Improve "change vnc" error reporting Markus Armbruster
2022-12-20 11:23 ` Philippe Mathieu-Daudé
2022-12-20 9:06 ` [PATCH v3 14/18] ui: Factor out hmp_change_vnc(), and move to ui/ui-hmp-cmds.c Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 15/18] ui: Reduce nesting in hmp_change_vnc() slightly Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 16/18] ui: Split hmp_mouse_set() and move the HMP part to ui/ Markus Armbruster
2022-12-20 9:15 ` Daniel P. Berrangé
2022-12-20 11:20 ` Markus Armbruster
2022-12-20 11:17 ` Philippe Mathieu-Daudé
2023-01-09 14:35 ` Markus Armbruster
2022-12-20 9:06 ` [PATCH v3 17/18] ui: Don't check for mode change after mouse_set error Markus Armbruster
2022-12-20 9:16 ` Daniel P. Berrangé
2022-12-20 9:06 ` [PATCH v3 18/18] ui: Simplify control flow in qemu_mouse_set() Markus Armbruster
2022-12-20 9:17 ` Daniel P. Berrangé
2022-12-20 10:52 ` [PATCH v3 00/18] ui: Move and clean up monitor command code Philippe Mathieu-Daudé
2022-12-20 11:17 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221220090645.2844881-13-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=kraxel@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).