summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-11-05 13:47:32 +0100
committerOskar Nyberg <oskar@mullvad.net>2021-11-16 12:24:37 +0100
commit8f1b299c722294280f7ee0f9946a917dfee55d25 (patch)
tree8cc1f94722f7d22eb92e2f950b64d81eccdc718c
parent21e92cde7d2695b9d72c96de16dae2e494166ecf (diff)
downloadmullvadvpn-8f1b299c722294280f7ee0f9946a917dfee55d25.tar.xz
mullvadvpn-8f1b299c722294280f7ee0f9946a917dfee55d25.zip
Check content height on resize
-rw-r--r--gui/src/main/window-controller.ts2
-rw-r--r--gui/src/renderer/app.tsx12
2 files changed, 10 insertions, 4 deletions
diff --git a/gui/src/main/window-controller.ts b/gui/src/main/window-controller.ts
index 1904383475..c42d0398e3 100644
--- a/gui/src/main/window-controller.ts
+++ b/gui/src/main/window-controller.ts
@@ -263,7 +263,7 @@ export default class WindowController {
}
}
- // On linux, the window won't be properly rescaled back to it's original
+ // On Linux and Windows, 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')) {
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index 7880352d7b..0acbd25ab2 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -224,7 +224,10 @@ export default class AppRenderer {
void this.onDaemonConnected();
}
- this.checkContentHeight();
+ this.checkContentHeight(false);
+ window.addEventListener('resize', () => {
+ this.checkContentHeight(true);
+ });
if (initialState.windowsSplitTunnelingApplications) {
this.reduxActions.settings.setSplitTunnelingApplications(
@@ -577,7 +580,7 @@ export default class AppRenderer {
// purposes since there's a bug in Electron that causes the app height to be another value than
// the one we have set.
// https://github.com/electron/electron/issues/28777
- private checkContentHeight(): void {
+ private checkContentHeight(resize: boolean): void {
let expectedContentHeight = 568;
// The app content is 12px taller on macOS to fit the top arrow.
@@ -587,7 +590,10 @@ export default class AppRenderer {
const contentHeight = window.innerHeight;
if (contentHeight !== expectedContentHeight) {
- log.error(`Wrong content height ${contentHeight}, expected ${expectedContentHeight}`);
+ log.debug(
+ resize ? 'Resize:' : 'Initial:',
+ `Wrong content height: ${contentHeight}, expected ${expectedContentHeight}`,
+ );
}
}