mattermost / desktop

Mattermost Desktop application for Windows, Mac and Linux
Apache License 2.0
2k stars 815 forks source link

[MM-58357] Account for monitor scale factor when creating the window from saved bounds #3045

Closed devinbinnie closed 4 months ago

devinbinnie commented 4 months ago

Summary

When we create the main window of the app using saved bounds from the disk, if the screen that we are putting the window is scaled to a higher value than 100%, the window will try to render outside the boundaries of the screen in a multi-monitor environment.

This is due to a bug in Electron (https://github.com/electron/electron/issues/10862) where the setBounds() function of the BrowserWindow seems to ignore scale factor altogether. This PR contains a workaround that will manually resize the saved bounds using the scale factor of the target monitor to put the window back correctly, avoiding any multi-monitor overlap.

Ticket Link

https://mattermost.atlassian.net/browse/MM-58357 Closes https://github.com/mattermost/desktop/issues/3039

Fixed an issue where scaled monitors in a multi-monitor setup may cause the window to be opened across 2 screens.
devinbinnie commented 3 months ago

/cherry-pick release-5.8

mattermost-build commented 3 months ago

Cherry pick is scheduled.