On Wed, 8 Oct 2025 18:17:11 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.
>
> Kevin Rushforth has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains three additional 
> commits since the last revision:
> 
>  - Merge branch 'master' into 8252373-mac-dual-screen-owned-stage
>  - Remove or comment out log messages
>  - 8252373: [macOS] Stage with owner disappears when moved to another screen

Code change looks good to me.
I have tested using test samples present in JBS issues(including the 
duplicates) and HelloModality and everything works fine.

But i see change in behaviour when child window doesn't move along with owner 
window after this update.
Bug that we are trying to solve is when window is moved to another screen but 
difference in behaviour is happening even when we move it within the same 
screen. Do we need to capture this change in behaviour through a release note?

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1932#issuecomment-3409873538

Reply via email to