From ed98550088fb415ffd0b685852dc12d5da80e0ab Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:09:40 +0000 Subject: [PATCH] Add option for no keymap. --- emhttp/plugins/dynamix.vm.manager/include/libvirt.php | 4 ++-- emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index 9a625ebac..21db2187c 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -789,7 +789,7 @@ if ($gpu['id'] == 'virtual') { $strKeyMap = ''; if (!empty($gpu['keymap'])) { - $strKeyMap = "keymap='" . $gpu['keymap'] . "'"; + if ($gpu['keymap'] != "none") $strKeyMap = "keymap='" . $gpu['keymap'] . "'"; } $passwdstr = ''; @@ -2085,7 +2085,7 @@ function domain_get_vnc_keymap($domain) { $tmp = $this->get_xpath($domain, '//domain/devices/graphics/@keymap', false); if (!$tmp) - return 'en-us'; + return 'none'; $var = $tmp[0]; unset($tmp); diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php index 1c6a33402..e9dc13f1a 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php @@ -1089,6 +1089,7 @@ private static $encoding = 'UTF-8'; function getValidKeyMaps() { $arrValidKeyMaps = [ + 'none' => 'No Keymap', 'ar' => 'Arabic (ar)', 'hr' => 'Croatian (hr)', 'cz' => 'Czech (cz)', @@ -1413,6 +1414,7 @@ private static $encoding = 'UTF-8'; // preserve vnc/spice port settings // unset($new['devices']['graphics']['@attributes']['port'],$new['devices']['graphics']['@attributes']['autoport']); if (!$new['devices']['graphics']) unset($old['devices']['graphics']); + if (!isset($new['devices']['graphics']['@attributes']['keymap']) && isset($old['devices']['graphics']['@attributes']['keymap'])) unset($old['devices']['graphics']['@attributes']['keymap']) ; // update parent arrays if (!$old['devices']['hostdev']) unset($old['devices']['hostdev']); if (!$new['devices']['hostdev']) unset($new['devices']['hostdev']);