[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 16/17] monitor: Add mouse_set index argument comp
From: |
Hani Benhabiles |
Subject: |
[Qemu-devel] [PATCH v2 16/17] monitor: Add mouse_set index argument completion. |
Date: |
Sun, 30 Mar 2014 11:58:38 +0100 |
Signed-off-by: Hani Benhabiles <address@hidden>
---
hmp-commands.hx | 1 +
hmp.h | 1 +
monitor.c | 22 ++++++++++++++++++++++
3 files changed, 24 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index b41a6d6..04aa059 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -734,6 +734,7 @@ ETEXI
.params = "index",
.help = "set which mouse device receives events",
.mhandler.cmd = do_mouse_set,
+ .command_completion = mouse_set_completion,
},
STEXI
diff --git a/hmp.h b/hmp.h
index 12f0364..6e76473 100644
--- a/hmp.h
+++ b/hmp.h
@@ -112,5 +112,6 @@ void migrate_set_capability_completion(ReadLineState *rs,
int nb_args,
void host_net_add_completion(ReadLineState *rs, int nb_args, const char *str);
void host_net_remove_completion(ReadLineState *rs, int nb_args,
const char *str);
+void mouse_set_completion(ReadLineState *rs, int nb_args, const char *str);
#endif
diff --git a/monitor.c b/monitor.c
index 9781ee2..385fb70 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4657,6 +4657,28 @@ void host_net_remove_completion(ReadLineState *rs, int
nb_args, const char *str)
}
}
+void mouse_set_completion(ReadLineState *rs, int nb_args, const char *str)
+{
+ size_t len;
+ MouseInfoList *mice_list, *mouse;
+ if (nb_args != 2) {
+ return;
+ }
+ len = strlen(str);
+ readline_set_completion_index(rs, len);
+ mice_list = mouse = qmp_query_mice(NULL);
+ while (mouse) {
+ char name[16];
+ snprintf(name, sizeof(name), "%" PRId64, mouse->value->index);
+
+ if (!strncmp(str, name, len)) {
+ readline_add_completion(rs, name);
+ }
+ mouse = mouse->next;
+ }
+ qapi_free_MouseInfoList(mice_list);
+}
+
static void monitor_find_completion_by_table(Monitor *mon,
const mon_cmd_t *cmd_table,
char **args,
--
1.8.3.2
- [Qemu-devel] [PATCH v2 06/17] monitor: Add cpu index argument completion., (continued)
- [Qemu-devel] [PATCH v2 06/17] monitor: Add cpu index argument completion., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 07/17] monitor: Add set_link arguments completion., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 08/17] monitor: Add netdev_add type argument completion., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 09/17] monitor: Add netdev_del id argument completion., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 10/17] monitor: Add ringbuf_write and ringbuf_read argument completion., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 11/17] monitor: Add watchdog_action argument completion., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 12/17] monitor: Add migrate_set_capability completion., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 13/17] monitor: Add host_net_add device argument completion., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 14/17] readline: Make completion strings always unique., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 15/17] monitor: Add host_net_remove arguments completion., Hani Benhabiles, 2014/03/30
- [Qemu-devel] [PATCH v2 16/17] monitor: Add mouse_set index argument completion.,
Hani Benhabiles <=
- [Qemu-devel] [PATCH v2 17/17] monitor: Add delvm and loadvm argument completion., Hani Benhabiles, 2014/03/30