]> git.proxmox.com Git - mirror_qemu.git/commitdiff
ui/console: simplify getting active_console size
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 30 Aug 2023 09:38:06 +0000 (13:38 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 4 Sep 2023 10:00:21 +0000 (14:00 +0400)
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>

ui/console.c

index 5d521ba79d31c5dc4a536d1ca4347552f708e1da..70e11f924d8132a3f4fcbe1a0b06c6ad23e57f72 100644 (file)
@@ -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;
     }