RFR: 8316419: [macos] Setting X/Y makes Stage maximization not work before show [v2]

Martin Fox duke at openjdk.org
Thu Oct 26 15:03:52 UTC 2023


On Sat, 21 Oct 2023 00:10:50 GMT, Martin Fox <duke at openjdk.org> wrote:

>> When a window is visible the maximized, iconified, and fullscreen properties are two-way streets; changes made in Java are sent on to the platform window and changes in the platform window are sent back into Java.
>> 
>> When a window is hidden these properties (and others, like location and sizing information) are not sent on to the platform window until the window is made visible. In other words, the properties don't reflect the actual state of the window but the intended state after it's shown.
>> 
>> There's a period when the window is transitioning from hidden to shown where the core Stage code is using the stored properties to configure the platform window and the platform window is simultaneously calling back in to update the properties. This was causing the intended state to be wiped out before it could be sent on to the platform window.
>> 
>> The problem is specific to Mac because on that platform any change to the size or location of a window can cause it to enter or leave the maximized (zoomed) state. So just setting the location can cause the maximized flag to be altered.
>> 
>> The proposed solution is to copy the intended state bits to Stage local variables to be used later in the configuration.
>
> Martin Fox has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Revert core changes. Fix Mac glass code so it reports maximized state correctly.

I'm also adding [JDK-8305675](https://bugs.openjdk.org/browse/JDK-8305675) which covers `setIconified`. The bogus `isZoomed` results were causing the core to think that the window had been maximized and then restored and that last step wiped out both the maximized and iconified properties.

JDK-8305675 should be tested using the StartIconified test in tests/manual/stage/StartIconified.java. Despite what the test says the window should pop up briefly before iconifying. I have no idea why that isn't happening on Linux given the way the core code works.

If you de-iconify the window it might be blank. That also happens on Linux and is related to a timing issue. I'll make sure a bug is entered against it.

JDK-8305675 mentions exceptions raised by SceneChangeShouldNotFocusStageTest but that's not Mac-specific and has been spun off to another bug.

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

PR Comment: https://git.openjdk.org/jfx/pull/1258#issuecomment-1781305434


More information about the openjfx-dev mailing list