From: Szymon Lukasz <[email protected]> The terminal size of a mux chardev should be the same as the real chardev, so listen for CHR_EVENT_RESIZE to be up to date.
We forward CHR_EVENT_RESIZE only to the focused frontend. This means frontends should update their view of the terminal size on receiving CHR_EVENT_MUX_IN. Signed-off-by: Szymon Lukasz <[email protected]> Reviewed-by: Daniel P. Berrangé <[email protected]> Signed-off-by: Filip Hejsek <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> Message-ID: <[email protected]> --- chardev/char-mux.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/chardev/char-mux.c b/chardev/char-mux.c index 881443d869d8..5a90f0221b48 100644 --- a/chardev/char-mux.c +++ b/chardev/char-mux.c @@ -264,9 +264,24 @@ void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event) } } +static void mux_update_winsize(Chardev *chr) +{ + MuxChardev *d = MUX_CHARDEV(chr); + uint16_t cols, rows; + + qemu_chr_fe_get_winsize(&d->chr, &cols, &rows); + qemu_chr_resize(chr, cols, rows); +} + static void mux_chr_event(void *opaque, QEMUChrEvent event) { - mux_chr_send_all_event(CHARDEV(opaque), event); + Chardev *chr = CHARDEV(opaque); + + if (event == CHR_EVENT_RESIZE) { + mux_update_winsize(chr); + } else { + mux_chr_send_all_event(chr, event); + } } static GSource *mux_chr_add_watch(Chardev *s, GIOCondition cond) @@ -378,6 +393,8 @@ static bool mux_chr_open(Chardev *chr, ChardevBackend *backend, Error **errp) return false; } + mux_update_winsize(chr); + /* * Only move to opened state if we've realized * the initial set of muxes: -- 2.56.0.116.g6de20f6092dc
