mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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
This commit is contained in:
parent
731b03642d
commit
2724b1806a
5 changed files with 42 additions and 10 deletions
11
qemu-char.c
11
qemu-char.c
|
@ -310,6 +310,12 @@ static void mux_print_help(CharDriverState *chr)
|
|||
}
|
||||
}
|
||||
|
||||
static void mux_chr_send_event(MuxDriver *d, int mux_nr, int event)
|
||||
{
|
||||
if (d->chr_event[mux_nr])
|
||||
d->chr_event[mux_nr](d->ext_opaque[mux_nr], event);
|
||||
}
|
||||
|
||||
static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch)
|
||||
{
|
||||
if (d->term_got_escape) {
|
||||
|
@ -341,9 +347,11 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch)
|
|||
break;
|
||||
case 'c':
|
||||
/* Switch to the next registered device */
|
||||
mux_chr_send_event(d, chr->focus, CHR_EVENT_MUX_OUT);
|
||||
chr->focus++;
|
||||
if (chr->focus >= d->mux_cnt)
|
||||
chr->focus = 0;
|
||||
mux_chr_send_event(d, chr->focus, CHR_EVENT_MUX_IN);
|
||||
break;
|
||||
case 't':
|
||||
term_timestamps = !term_timestamps;
|
||||
|
@ -413,8 +421,7 @@ static void mux_chr_event(void *opaque, int event)
|
|||
|
||||
/* Send the event to all registered listeners */
|
||||
for (i = 0; i < d->mux_cnt; i++)
|
||||
if (d->chr_event[i])
|
||||
d->chr_event[i](d->ext_opaque[i], event);
|
||||
mux_chr_send_event(d, i, event);
|
||||
}
|
||||
|
||||
static void mux_chr_update_read_handler(CharDriverState *chr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue