From 723a7c613313d5cc257d7aac1eb98c678a3d8549 Mon Sep 17 00:00:00 2001 From: WofWca Date: Tue, 1 Oct 2024 13:20:12 +0400 Subject: [PATCH] fix: window overflowing small screens ...with high zoom level. Closes https://github.com/deltachat/deltachat-desktop/issues/4063 --- packages/target-electron/src/application-constants.ts | 6 ++++-- packages/target-electron/src/windows/helpers.ts | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/target-electron/src/application-constants.ts b/packages/target-electron/src/application-constants.ts index ace7f6e503..e9396d724c 100644 --- a/packages/target-electron/src/application-constants.ts +++ b/packages/target-electron/src/application-constants.ts @@ -40,8 +40,10 @@ export function windowDefaults() { y, }, headerHeight, - minWidth: 450, - minHeight: 450, + // On 0.6x zoom Delta Chat and 200x window size it's still somewhat usable, + // not much is overflowing. + minWidth: 225, + minHeight: 125, main: targetFile, preload: join(htmlDistDir(), 'preload.js'), } diff --git a/packages/target-electron/src/windows/helpers.ts b/packages/target-electron/src/windows/helpers.ts index 2f36cb2524..78b360fae4 100644 --- a/packages/target-electron/src/windows/helpers.ts +++ b/packages/target-electron/src/windows/helpers.ts @@ -11,7 +11,12 @@ export function initMinWinDimensionHandling( ): () => void { const update_min_size = () => { const { workAreaSize } = screen.getPrimaryDisplay() - if (workAreaSize.width < minWidth || workAreaSize.height < minHeight) { + if ( + // A multiplier to make space for the taskbar and the window header. + // Remember that the taskbar could also be placed vertically. + workAreaSize.width * 0.75 < minWidth || + workAreaSize.height * 0.75 < minHeight + ) { main_window.setMinimumSize(0, 0) } else { main_window.setMinimumSize(minWidth, minHeight)