]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: SDL fullscreen option refactor
authorKirill Shchetiniuk <kshcheti@redhat.com>
Wed, 4 Jun 2025 12:24:13 +0000 (14:24 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 4 Jun 2025 14:59:07 +0000 (16:59 +0200)
Previously, the fullscreen option were parsed as a tristate but stored
as a bool type, changed the fullscreen option type to tristate bool to
avoid unnecessary type convertions.

Signed-off-by: Kirill Shchetiniuk <kshcheti@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c
src/conf/domain_conf.h
src/qemu/qemu_command.c

index c16aa279fb4d5eb4a47bdcdebfbdf60c52977fbc..32a358d72c569b74dd9a91c0497ff39c818824aa 100644 (file)
@@ -11891,15 +11891,13 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDef *def,
 {
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
     xmlNodePtr glNode;
-    virTristateBool fullscreen;
 
     ctxt->node = node;
 
     if (virXMLPropTristateBool(node, "fullscreen", VIR_XML_PROP_NONE,
-                               &fullscreen) < 0)
+                               &def->data.sdl.fullscreen) < 0)
         return -1;
 
-    virTristateBoolToBool(fullscreen, &def->data.sdl.fullscreen);
     def->data.sdl.xauth = virXMLPropString(node, "xauth");
     def->data.sdl.display = virXMLPropString(node, "display");
 
@@ -26956,8 +26954,9 @@ virDomainGraphicsDefFormatSDL(virBuffer *attrBuf,
 
     virBufferEscapeString(attrBuf, " xauth='%s'", def->data.sdl.xauth);
 
-    if (def->data.sdl.fullscreen)
-        virBufferAddLit(attrBuf, " fullscreen='yes'");
+    if (def->data.sdl.fullscreen != VIR_TRISTATE_BOOL_ABSENT)
+        virBufferAsprintf(attrBuf, " fullscreen='%s'",
+                          virTristateBoolTypeToString(def->data.sdl.fullscreen));
 
     virDomainGraphicsDefFormatGL(childBuf, def->data.sdl.gl, NULL);
 }
index 58b97a2b54900f2c6b54facfbd3c7951ca51516b..8df404dc42498533d1f80ffe440ffa09c59b26f2 100644 (file)
@@ -2036,7 +2036,7 @@ struct _virDomainGraphicsDef {
         struct {
             char *display;
             char *xauth;
-            bool fullscreen;
+            virTristateBool fullscreen;
             virTristateBool gl;
         } sdl;
         struct {
index edafe1588c751095d2dd4a4367a870969a58218d..77e7ea12994788b494ee773715ab95c7d0bb7534 100644 (file)
@@ -8108,7 +8108,7 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfig *cfg G_GNUC_UNUSED,
         virCommandAddEnvPair(cmd, "XAUTHORITY", graphics->data.sdl.xauth);
     if (graphics->data.sdl.display)
         virCommandAddEnvPair(cmd, "DISPLAY", graphics->data.sdl.display);
-    if (graphics->data.sdl.fullscreen)
+    if (graphics->data.sdl.fullscreen == VIR_TRISTATE_BOOL_YES)
         virCommandAddArg(cmd, "-full-screen");
 
     virCommandAddArg(cmd, "-display");