On Wed, 8 Oct 2025 13:57:16 GMT, Kevin Rushforth <[email protected]> wrote:
> This PR fixes the bug where owned stage will disappear on macOS if it is > moved to another screen with the Mission Control setting of "Displays have > separate spaces" enabled (which it is by default). > > We fix this by managing owned windows ourself in glass rather than relying on > NSWindow's childWindow feature, which we currently do. This matches what AWT > does. > > ### Notes to reviewers: > > The following changes are implemented: > > * Each GlassWindow keeps a list of owned (child) windows. A window with an > owner adds itself to its owner's list of child windows when created and > removes itself when closed > * A new `reorderChildWindows` method is created to stack each child window > above its owner, setting the level to be at least the same as its owner (to > handle the case of an owned window of an always-on-top owner window). We call > `reorderChildWindows` in various places that can alter the window stacking > order, so we can preserve the desired order. > * When an owner window is closed, all child windows are recursively closed. > * When an owner window is iconified / deiconified, all child windows are > recursively iconified / deiconified. > * When an owner window enters full screen, it recursively sets the > `NSWindowCollectionBehaviorMoveToActiveSpace` behavior to temporarily enable > moving the child window to the active space > > Testing: > > * Most of the testing can be done on a single screen, but you will need 2 > screens to reproduce the bug by dragging an owned window from one screen to > another (and verify that it is fixed) > * You can use the updated HelloModality test app to test this. It already had > most of what was needed to test the various combinations; I added the ability > to create / toggle the alwaysOnTop property of a Stage and the ability to > initially create a stage on a secondary screen. I also added tooltips, which > are implemented using owned popup windows. > * MonkeyTester also has some dialog tests that can be used to verify the > behavior > > NOTE: dragging an owner window no longer causes all child windows to move in > lock step; this means that owned windows will now works more like it does on > the Windows platform. Reviewers: @andy-goryachev-oracle @beldenfox @arapte Cc: @FlorianKirmaier @jperedadnr ------------- PR Comment: https://git.openjdk.org/jfx/pull/1932#issuecomment-3382512801
