Window restoration on Monterey not working correctly

macOS Version: 12.0.1 (21A559)

We have an app which auto saves window positions and re-opens and restores them on launch. We normally use `setFrameUsingName:force: to reposition the window.

Now in Monterey this works incorrectly if the window is not on the main screen in a multi-screen setup – Monterey relocates the window to the main screen. The position is roughly equivalent to where it was previously on its original screen, i.e. if it was in a corner it moves to roughly the corner on the main screen even if the screen sizes are different. This suggests to us it likely intentional and not a bug per se, but that is just a guess.

We've tried using setFrameFromString: after reading the saved user defaults value ourselves, still gets relocated.

However reading the user defaults directly, deleting it so AppKit doesn't use it behind the scenes, parsing the frame value from it, and using setFrame:display: restores the correct behaviour. It's a hack, gated by a test for Monterey, but it works.

Given it looks like it might be intentional behaviour is there a way to turn it off?

Or is there some other fix?

TIA