From 6e6dc3aa1f4d9b781efa2a45c8653afa7e3e2069 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 --- CHANGELOG.md | 1 + packages/target-electron/src/application-constants.ts | 6 ++++-- packages/target-electron/src/windows/helpers.ts | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e694e794c..4acd50980 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ - crash on clicking "About" when no account is selected (e.g. after deleting an account) #4154 - show "new group" instead of "new contact" when pasting a group invite link in the search field #4151 - message input getting unexpectedly re-focused, and not re-focused after some actions if the draft text is not empty #4136 +- the main window overflowing small screens, or/and if zoom level is high #4156 diff --git a/packages/target-electron/src/application-constants.ts b/packages/target-electron/src/application-constants.ts index ace7f6e50..e9396d724 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 2f36cb252..78b360fae 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)