mattermost / desktop

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

[MM-59492] Fixed `isInsideRectangle`, and removed null check for matchingScreen since it will always return something #3093

Closed devinbinnie closed 4 months ago

devinbinnie commented 4 months ago

Summary

There was a case as described in the ticket below where a user could get the window to display off the screen. This was due to a flaw in isInsideRectangle where we weren't checking the bounds correctly (we were only checking that it was inside from the top-left corner, which is fine in single-monitor setups, but not multi-monitor). Additionally, I had expected getMatchingScreen to return false if it doesn't find one, but it always just gets the primary screen in the worse case.

This PR fixes and adds tests for isInsideRectangle, as well removes the null check for getMatchingScreen

Ticket Link

https://mattermost.atlassian.net/browse/MM-59492 Closes https://github.com/mattermost/desktop/issues/3087

Fixed an issue where the window might be rendered off-screen in multi-monitor setups