diff --git a/Engines/Wine/Plugins/virtual desktop/script.js b/Engines/Wine/Plugins/virtual desktop/script.js index 126bca3d9a..4e8485cca9 100644 --- a/Engines/Wine/Plugins/virtual desktop/script.js +++ b/Engines/Wine/Plugins/virtual desktop/script.js @@ -1,15 +1,25 @@ +/* eslint-disable no-undef */ const Wine = include("engines.wine.engine.object"); +const {getScreenWidth, getScreenHeight} = include("utils.functions.system.virtual_desktop"); include("engines.wine.plugins.regedit"); /** - * sets Virtual Desktop with window resolution + * Sets Virtual Desktop with window resolution * @param {number} width width of virtual desktop (in px) * @param {number} height height of virtual desktop (in px) * @returns {Wine} Wine object */ Wine.prototype.setVirtualDesktop = function (width, height) { - var regeditFileContent = + if (!width) + { + width = getScreenWidth(); + } + if (!height) + { + height = getScreenHeight(); + } + const regeditFileContent = "REGEDIT4\n" + "\n" + "[HKEY_CURRENT_USER\\Software\\Wine\\Explorer\\Desktops]\n" + @@ -18,4 +28,4 @@ Wine.prototype.setVirtualDesktop = function (width, height) { "\"Desktop\"=\"" + "Default" + "\"\n"; this.regedit().patch(regeditFileContent); return this; -}; \ No newline at end of file +}; diff --git a/Utils/Functions/System/application.json b/Utils/Functions/System/application.json new file mode 100644 index 0000000000..5a2e9a7f46 --- /dev/null +++ b/Utils/Functions/System/application.json @@ -0,0 +1,5 @@ +{ + "name" : "System Utils", + "id" : "utils.functions.system", + "description" : "Utils for system interaction." +} diff --git a/Utils/Functions/System/virtual desktop/script.js b/Utils/Functions/System/virtual desktop/script.js new file mode 100644 index 0000000000..e198c1c52f --- /dev/null +++ b/Utils/Functions/System/virtual desktop/script.js @@ -0,0 +1,20 @@ +const screenManager = Bean("screenManager"); + +/** + * Obtains the width of user's screen + * @returns {number} width of user's screen in pixels + */ +function getScreenWidth() { + return screenManager.getScreenWidth(); +} + +/** + * Obtains the height of user's screen + * @returns {number} height of user's screen in pixels + */ +function getScreenHeight() { + return screenManager.getScreenHeight(); +} + +module.getScreenWidth = getScreenWidth; +module.getScreenHeight = getScreenHeight; diff --git a/Utils/Functions/System/virtual desktop/script.json b/Utils/Functions/System/virtual desktop/script.json new file mode 100644 index 0000000000..ecc94909af --- /dev/null +++ b/Utils/Functions/System/virtual desktop/script.json @@ -0,0 +1,11 @@ +{ + "scriptName" : "virtual desktop", + "id" : "utils.functions.system.virtual_desktop", + "compatibleOperatingSystems" : [ + "MACOSX", + "LINUX" + ], + "testingOperatingSystems" : [], + "free" : true, + "requiresPatch" : false +}