On Tue, 10 Mar 2026 13:31:18 GMT, Jose Pereda <[email protected]> wrote:

>> This PR adds a fix to prevent a crash on macOS after exiting full screen 
>> mode when a modal dialog is showing 
>> (https://bugs.openjdk.org/browse/JDK-8371370).
>> 
>> At the same time, it prevents non-resizable windows from entering full 
>> screen mode (https://bugs.openjdk.org/browse/JDK-8379315), given that the 
>> changes for both issues were interrelated.
>> 
>> While no tests have been added, manual tests have been run, checking that 
>> the style mask, the window behavior and the standard window buttons state, 
>> remained consistent in different scenarios.
>> 
>> Also, according to 
>> https://developer.apple.com/documentation/appkit/nswindow/showsresizeindicator,
>>  the `showsResizeIndicator` property has been removed.
>
> Jose Pereda has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Keep undecorated windows behavior, allowing access to full screen mode

I've updated the original bug report with some additional information.

There are two separate systems trying to save and restore the 
NSWindowStyleMaskResizable flag, one for when the window is disabled and 
re-enabled and another for entering and existing fullscreen. This is fragile 
since it only works if things happen in a very specific order. I don't think 
this bug can be truly fixed until these two save/restore mechanisms are either 
unified into one mechanism or removed. I vote for removing them and added some 
notes to the bug report on how I think that would work.

In this bug the OS is providing a round-about way of entering fullscreen mode 
while the window is disabled. To prevent that this PR is dynamically adding and 
removing the fullscreen collection behavior. That's a good idea but needs to be 
followed up with some additional code to bullet-proof any calls to 
toggleFullScreen. If the collection behavior isn't set when we call 
toggleFullScreen Glass will enter the fullscreen exiting loop and never leave 
it. We need to ensure that never happens.

In the past a client has always been able to call Stage.setFullScreen(true) to 
put a stage into fullscreen mode regardless of StageStyle and even if it has 
been made non-resizable using Stage.setResizable. To keep that behavior we need 
to ensure that Stage.setFullScreen always adds the fullscreen collection 
behavior to the NSWindow the same way it always adds the 
NSWindowStyleMaskResizable.

Personally I think we should do a localized fix to avoid the crash; when 
restoring the styleMask avoid altering the NSWindowStyleMaskFullScreen bit. 
Then we can do a separate PR to remove the two save/restore systems that are 
fighting over the Resizable style mask bit. And then another PR to add and 
remove the full screen collection behavior dynamically.

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

PR Comment: https://git.openjdk.org/jfx/pull/2098#issuecomment-4298488325

Reply via email to