Skip to content

Commit

Permalink
fix: window overflowing small screens
Browse files Browse the repository at this point in the history
...with high zoom level.

Closes #4063
  • Loading branch information
WofWca committed Oct 1, 2024
1 parent c981d4e commit 6e6dc3a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<a id="1_46_8"></a>

Expand Down
6 changes: 4 additions & 2 deletions packages/target-electron/src/application-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
}
Expand Down
7 changes: 6 additions & 1 deletion packages/target-electron/src/windows/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6e6dc3a

Please sign in to comment.