summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2018-10-09 12:40:12 +0100
committerEmīls Piņķis <emils@mullvad.net>2018-10-09 12:40:12 +0100
commitc231604e1b4fa1bb9e7e7a1a3b254892e22ddcfc (patch)
treef8454a6fcc014f3b3aa0fcb1c9e98d33c228850f /gui
parent25338b4564610089aa7e9243721c9cbdde96b349 (diff)
parent0de3a503501dc93ffe60530c98f788b5df78e83d (diff)
downloadmullvadvpn-c231604e1b4fa1bb9e7e7a1a3b254892e22ddcfc.tar.xz
mullvadvpn-c231604e1b4fa1bb9e7e7a1a3b254892e22ddcfc.zip
Merge branch 'resize-window-on-metric-change'
Diffstat (limited to 'gui')
-rw-r--r--gui/packages/desktop/src/main/window-controller.js17
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;