bitsdojo_window icon indicating copy to clipboard operation
bitsdojo_window copied to clipboard

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

Open korvan opened this issue 4 years ago • 0 comments

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.

korvan avatar Jun 23 '21 09:06 korvan