monitor: fix muxing

make the mux driver send mux_in and mux_out events when switching
focus while hooking up more handlers.

stop using CharDriverState->focus in monitor.c, track state using
the mux events instead.  This also removes the implicit assumtion
that a muxed monitor allways has mux channel 0.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Gerd Hoffmann 2009-09-10 10:58:54 +02:00 committed by Anthony Liguori
parent 06113719be
commit a7aec5da4d
2 changed files with 28 additions and 11 deletions

View file

@ -456,8 +456,12 @@ static void mux_chr_update_read_handler(CharDriverState *chr)
qemu_chr_add_handlers(d->drv, mux_chr_can_read, mux_chr_read,
mux_chr_event, chr);
}
if (chr->focus != -1) {
mux_chr_send_event(d, chr->focus, CHR_EVENT_MUX_OUT);
}
chr->focus = d->mux_cnt;
d->mux_cnt++;
mux_chr_send_event(d, chr->focus, CHR_EVENT_MUX_IN);
}
static CharDriverState *qemu_chr_open_mux(CharDriverState *drv)