On Tue, 24 Mar 2026 16:18:33 GMT, Martin Fox <[email protected]> wrote:

>> Jose Pereda has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Address feedback
>
> modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Overrides.m 
> line 342:
> 
>> 340:     // For non-auto-hide popups, jWindowNotifyClose fires 
>> WINDOW_CLOSE_REQUEST,
>> 341:     // and that calls hide() on the popup.
>> 342:     if ([self->nsWindow isVisible]) {
> 
> Should non-auto-hide popups be hidden? The spec doesn't talk about them much 
> and I'm not sure what they're used for.

That's a very good question, indeed.

I'm testing a native Xcode project, and a `NSPanel` by default is 
non-auto-hide. For instance, `Finder -> Get Info` opens an auxiliary window, 
and it won't close when opening the system menu bar or clicking elsewhere. 

However, `Finder -> right click on a file-> Context Menu` is auto-hide (hides 
when clicking the system menu bar or elsewhere). 

The main difference is that the native ContextMenu window is actually a 
`NSMenu`, while in JavaFX we use `NSPanel` for all popups, and we install event 
handlers to treat it as auto-hide or non-auto-hide.

With this PR as is, the non-auto-hide popups should be closed when clicking 
over the system menu bar, but now I see that `PopupWindowPeerListener::closing` 
overrides `WindowPeerListener::closing` with an empty implementation, and 
`WINDOW_CLOSE_REQUEST` is not fired at all... 

So my call to `jWindowNotifyClose` in this case is wrong (it doesn't do 
anything). 

And while the non-auto-hide popup won't close (okay), the click on the system 
menu bar event is consumed and there is no way to show it while the popup is 
showing (wrong).

I'll rework this.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2102#discussion_r2990201622

Reply via email to