Skip to content

Commit

Permalink
ui/console: simplify getting active_console size
Browse files Browse the repository at this point in the history
We can get the active console dimension regardless of its kind, by
simply giving NULL as argument. It will fallback with the given value
when the dimensions aren't known.

This will also allow to move the code in a separate unit more easily.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230830093843.3531473-33-marcandre.lureau@redhat.com>
  • Loading branch information
elmarco committed Sep 4, 2023
1 parent 60cb14b commit 5e5a30b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ui/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -2577,10 +2577,8 @@ static void vc_chr_open(Chardev *chr,
drv->console = s;

if (QEMU_CONSOLE(s)->scanout.kind != SCANOUT_SURFACE) {
if (active_console && active_console->scanout.kind == SCANOUT_SURFACE) {
g_width = qemu_console_get_width(active_console, g_width);
g_height = qemu_console_get_height(active_console, g_height);
}
g_width = qemu_console_get_width(NULL, g_width);
g_height = qemu_console_get_height(NULL, g_height);
QEMU_CONSOLE(s)->surface = qemu_create_displaysurface(g_width, g_height);
QEMU_CONSOLE(s)->scanout.kind = SCANOUT_SURFACE;
}
Expand Down

0 comments on commit 5e5a30b

Please sign in to comment.