aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-05 23:01:47 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-05 23:01:47 +0000
commit2724b1806a63d66148cea62e1fe1cae3b417bc7e (patch)
tree4358154ee5b4d54dd14fbcd9a70a63a25e5defab /monitor.c
parent731b03642d0ac0365294c7b39713fede769a3f39 (diff)
downloadqemu-2724b1806a63d66148cea62e1fe1cae3b417bc7e.zip
qemu-2724b1806a63d66148cea62e1fe1cae3b417bc7e.tar.gz
qemu-2724b1806a63d66148cea62e1fe1cae3b417bc7e.tar.bz2
monitor: Improve mux'ed console experience (Jan Kiszka)
Up to now, you never really knew if you already switched the console after pressing CTRL-A C or if you mistyped it again. This patch clarifies the situation by providing a prompt in a new line and injecting a linebreak when switching away again. For this purpose, the two events CHR_EVENT_MUX_IN and CHR_EVENT_MUX_OUT are introduced and distributed on focus switches. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6716 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/monitor.c b/monitor.c
index ecd6758..d03de4f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2918,12 +2918,27 @@ static void monitor_event(void *opaque, int event)
{
Monitor *mon = opaque;
- if (event != CHR_EVENT_RESET)
- return;
+ switch (event) {
+ case CHR_EVENT_MUX_IN:
+ readline_restart(mon->rs);
+ monitor_resume(mon);
+ monitor_flush(mon);
+ break;
+
+ case CHR_EVENT_MUX_OUT:
+ if (mon->suspend_cnt == 0)
+ monitor_printf(mon, "\n");
+ monitor_flush(mon);
+ monitor_suspend(mon);
+ break;
- monitor_printf(mon, "QEMU %s monitor - type 'help' for more information\n",
- QEMU_VERSION);
- readline_show_prompt(mon->rs);
+ case CHR_EVENT_RESET:
+ monitor_printf(mon, "QEMU %s monitor - type 'help' for more "
+ "information\n", QEMU_VERSION);
+ if (mon->chr->focus == 0)
+ readline_show_prompt(mon->rs);
+ break;
+ }
}
void monitor_init(CharDriverState *chr, int flags)
@@ -2940,6 +2955,8 @@ void monitor_init(CharDriverState *chr, int flags)
mon->chr = chr;
mon->flags = flags;
+ if (mon->chr->focus != 0)
+ mon->suspend_cnt = 1; /* mux'ed monitors start suspended */
mon->rs = readline_init(mon, monitor_find_completion);
monitor_read_command(mon, 0);