summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--gui/packages/desktop/src/main/window-controller.js17
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;