On Thu, 2 Jul 2026 14:45:12 GMT, Andy Goryachev <[email protected]> wrote:

> Speaking of the system menu and `ApplicationServices`, macos-only features, 
> and the new API that are being brought in to the classes common to all the 
> platforms: could there be a better way to express the desired functionality?
> 
> So on mac, we have a number of features that are only available there - the 
> system menu, the notch, the key bar that I think they got rid of already. One 
> way to support these (used currently by javafx) is to add these API into 
> common classes (`MenuBar.setUseSystemMenuBar()` for example) which would be 
> no-op on other platforms.

The system menu bar is not Mac-centric by nature. The existing 
setUseSystemMenuBar API could potentially be implemented on Windows and Linux; 
the user would just see one platform-implemented menu bar per window instead of 
a shared one at the top of the screen. In fact it looks like this used to work 
but was removed? There are MenuBarDelegates for GTK and Windows still in the 
codebase and on Windows there's still code in Glass for building an HMENU. 
There's a middle layer in the Toolkit which assumes there's only one system 
menu bar but the machinery on either side of it could potentially allow one per 
window. Interesting.

But in general I agree with you. The system menu bar isn't inherently 
platform-specific but the application menu is. If we had a clean way of 
providing platform-specific calls I would consider closing out this PR and 
adding a Mac-specific call just for replacing the application menu. The only 
reason this PR allows for multiple common menus is that it seemed strange to 
provide a public API that was restricted to just one. But if we provided a 
Mac-specific API replacing just a single menu would make perfect sense.

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

PR Comment: https://git.openjdk.org/jfx/pull/1881#issuecomment-4928171724

Reply via email to