diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2018-10-08 16:20:10 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-10-09 12:39:49 +0100 |
| commit | 0de3a503501dc93ffe60530c98f788b5df78e83d (patch) | |
| tree | f8454a6fcc014f3b3aa0fcb1c9e98d33c228850f /gui | |
| parent | 25338b4564610089aa7e9243721c9cbdde96b349 (diff) | |
| download | mullvadvpn-0de3a503501dc93ffe60530c98f788b5df78e83d.tar.xz mullvadvpn-0de3a503501dc93ffe60530c98f788b5df78e83d.zip | |
Resize window if display metrics are changed on Linux
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/packages/desktop/src/main/window-controller.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gui/packages/desktop/src/main/window-controller.js b/gui/packages/desktop/src/main/window-controller.js index 704f9bae3e..ab32b1d6b7 100644 --- a/gui/packages/desktop/src/main/window-controller.js +++ b/gui/packages/desktop/src/main/window-controller.js @@ -130,6 +130,8 @@ class AttachedToTrayWindowPositioning implements WindowPositioning { export default class WindowController { _window: BrowserWindow; + _width: number; + _height: number; _windowPositioning: WindowPositioning; _isWindowReady = false; @@ -139,6 +141,9 @@ export default class WindowController { constructor(window: BrowserWindow, tray: Tray) { this._window = window; + const [width, height] = window.getSize(); + this._width = width; + this._height = height; if (process.platform === 'linux') { this._windowPositioning = new StandaloneWindowPositioning(); @@ -204,8 +209,20 @@ export default class WindowController { this._updatePosition(); this._notifyUpdateWindowShape(); } + + // On linux, the window won't be properly rescaled back to it's original + // size if the DPI scaling factor is changed. + // https://github.com/electron/electron/issues/11050 + if (process.platform === 'linux' && changedMetrics.includes('scaleFactor')) + { + this._forceResizeWindow(); + } }; + _forceResizeWindow() { + this._window.setSize(this._width, this._height); + } + _installWindowReadyHandlers() { this._window.once('ready-to-show', () => { this._isWindowReady = true; |
