From 19c16d3445e59835f55b187ef5381102b3b2cf33 Mon Sep 17 00:00:00 2001 From: Filip Hejsek Date: Mon, 12 Oct 2026 16:05:07 +0200 Subject: [PATCH] ui/console-vc: forward text console size to vc chardev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the vc chardev size when initializing the console and after changing the surface image. NOTE: There seems to be a bug in the code where the dpy_text_resize callback is not called when the size changes due to changing the surface image. (Though it doesn't cause any problem in practice because the callback is only used by ui/ncurses for fixed consoles, whose size never changes.) Signed-off-by: Filip Hejsek Reviewed-by: Marc-André Lureau Message-ID: <20261012-console-resize-v10-8-2c3b10d829b3@gmail.com> --- ui/console-vc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/console-vc.c b/ui/console-vc.c index 53d9e9d39b..99cc8f09c8 100644 --- a/ui/console-vc.c +++ b/ui/console-vc.c @@ -115,12 +115,19 @@ static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) return vt100_input(&s->vt, buf, len); } +static void text_console_chr_resize(QemuTextConsole *s) +{ + qemu_chr_resize(s->chr, s->vt.width, s->vt.height); +} + static void text_console_invalidate(void *opaque) { QemuTextConsole *s = QEMU_TEXT_CONSOLE(opaque); if (!QEMU_IS_FIXED_TEXT_CONSOLE(s)) { vt100_set_image(&s->vt, QEMU_CONSOLE(s)->surface->image); + text_console_chr_resize(s); + /* XXX Shouldn't qemu_text_console_update_size() also be called here? */ } vt100_refresh(&s->vt); } @@ -254,6 +261,7 @@ static bool vc_chr_open(Chardev *chr, ChardevBackend *backend, Error **errp) s->vt.t_attrib = TEXT_ATTRIBUTES_DEFAULT; } + text_console_chr_resize(s); qemu_chr_be_event(chr, CHR_EVENT_OPENED); qemu_console_notify(QEMU_CONSOLE_ADDED, QEMU_CONSOLE(s)); return true;