diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2018-10-09 12:40:12 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-10-09 12:40:12 +0100 |
| commit | c231604e1b4fa1bb9e7e7a1a3b254892e22ddcfc (patch) | |
| tree | f8454a6fcc014f3b3aa0fcb1c9e98d33c228850f | |
| parent | 25338b4564610089aa7e9243721c9cbdde96b349 (diff) | |
| parent | 0de3a503501dc93ffe60530c98f788b5df78e83d (diff) | |
| download | mullvadvpn-c231604e1b4fa1bb9e7e7a1a3b254892e22ddcfc.tar.xz mullvadvpn-c231604e1b4fa1bb9e7e7a1a3b254892e22ddcfc.zip | |
Merge branch 'resize-window-on-metric-change'
| -rw-r--r-- | CHANGELOG.md | 4 | ||||
| -rw-r--r-- | gui/packages/desktop/src/main/window-controller.js | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c6273c69cf..146635e87f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,10 @@ Line wrap the file at 100 chars. Th ### Fixed - Place Mssfix setting inside scrollable area +#### Linux +- The app will have it's window resized correctly when display scaling settings are changed. This + should also fix bad window behaviour on startup. + ## [2018.4-beta2] - 2018-10-08 ### Added 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; |
