From 2cb0791a2cf38674a5d1ece17e99eba4ba499dd6 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Fri, 20 Jun 2025 22:31:54 +0100 Subject: [PATCH] Enhance multimonitor support. --- .../dynamix.vm.manager/include/libvirt.php | 35 +++++++++++++-- .../templates/Custom.form.php | 43 ++++++++++++++++++- 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index f46d829ca..b2a873838 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -742,6 +742,7 @@ class Libvirt { if ($strProtocol == "spice") $virtualaudio = "spice"; else $virtualaudio = "none"; $strEGLHeadless = ""; $strAccel3d =""; + $additionalqxlheads = ""; if ($strModelType == "virtio3d") { $strModelType = "virtio"; if (!isset($gpu['render'])) $gpu['render'] = "auto"; @@ -756,6 +757,29 @@ class Libvirt { if ($strModelType == "qxl") { if (empty($gpu['DisplayOptions'])) $gpu['DisplayOptions'] ="ram='65536' vram='16384' vgamem='16384' heads='1' primary='yes'"; $strDisplayOptions = $gpu['DisplayOptions']; + preg_match_all("/(\w+)='([^']+)'/", $strDisplayOptions, $headmatches, PREG_SET_ORDER); + $headparams = []; + foreach ($headmatches as $headmatch) { + $headparams[$headmatch[1]] = $headmatch[2]; + } + + // Default heads to 1 if not found + $qxlheads = isset($headparams['heads']) ? (int)$headparams['heads'] : 1; + + $additionalqxlheads= ''; + if ($os_type == "windows") { + for ($i = 0; $i < $qxlheads - 1; $i++) { + $function = '0x' . dechex($i + 1); + $qxlvideo = << + +
+ + + XML; + $additionalqxlheads .= $qxlvideo; + } + } } $vmrc = " @@ -771,13 +795,16 @@ class Libvirt {
+ $additionalqxlheads