bitsdojo / bitsdojo_window

A Flutter package that makes it easy to customize and work with your Flutter desktop app window.
http://www.youtube.com/watch?v=bee2AHQpGK4
MIT License
815 stars 229 forks source link

[macos] appWindow.rect moves window out of screen if applied to frame on secondary screen #81

Open korvan opened 3 years ago

korvan commented 3 years ago
var rect = appWindow.rect
appWindow.rect = rect

Moves window out of screen if applied to window on secondary screen.

Assuming we have to screens(2560x1440), secondary screen is on the right of main screen. When I use getter (var rect = appWindow.rect), for window in topleft corner on main screen, I have rect with left corner coordinates (0, 0), and it works fine. For window in topleft corner on secondary screen, I have rect with left corner coordinates (2560, 0)

When I apply received value(appWindow.rect = rect):

BDWStatus setRectForWindow(NSWindow* window, BDWRect* rect) {
   NSRect fullScreenRect = [screen frame]; // has origin x = 2560
   ...
   frame.origin.x = fullScreenRect.origin.x + rect->left; // result frame origin.x = 2560*2
   ...
   [window setFrame:frame display:TRUE];
}

resulting frame origin is out of screen.