ui/console-vc: forward text console size to vc chardev

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 <filip.hejsek@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20261012-console-resize-v10-8-2c3b10d829b3@gmail.com>
This commit is contained in:
Filip Hejsek authored and Marc-André Lureau committed 2026-10-13 17:22:48 +04:00
1 parent 5c2132fe7e
commit 19c16d3445
1 file changed
+8
+8
View File
@@ -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;