I’ve submitted a PR (#2048) for enabling system backdrops in JavaFX windows. 
This allows JavaFX to tap into the translucent window backgrounds common on 
macOS and Windows 11. Since these effects require real-time blurring of the 
content behind the window they can only be rendered by the platform; JavaFX 
then alpha composites its content on top.

My goal was to come up with a useful set of backdrops which exhibit similar 
behavior across platforms. For example, all of the backdrops respond to the 
window’s color scheme preference when determining their dominant color and 
consistently obey accessibility settings like reduceTransparency.

I was not trying to support platform-specific backdrops like Glass on macOS 26. 
I don’t think Glass Regular is intended for top-level windows and Glass Clear 
is a special effect that only makes sense for something like the dock. (I also 
have some questions about the longevity of these effects. The UNIFIED stage 
style is defunct for a reason; glass and brushed metal window backgrounds don’t 
age well.)

The PR doesn’t support Linux. Blurred window backgrounds have been kicking 
around on Linux for some time but there hasn’t been a standardized API for 
requesting them. Wayland has just started the process of standardizing a 
background effect extension protocol and I have no idea what the deployment 
schedule might be.

The PR doesn’t support Windows 10. On that platform we need to program to a 
lower-level API and implement the entire backdrop effect ourselves responding 
to all the necessary window state changes and platform accessibility 
preferences. That API also requires a custom ViewPainter and altering Prism to 
deliver pixels to the window through a new path. The testing footprint for this 
would be large.

These backdrops cover the entire window which limits their utility for 
transparent stages. If you style, say, a menu with rounded corners and a drop 
shadow and then try to place a backdrop behind it the backdrop will extend 
behind the shadow and ignore the corner rounding. I think this is an inherent 
limitation. Even on a platform like macOS where we can shape the backdrop it 
would be tricky to align a shaped backdrop drawn by the platform with edge 
effects drawn by JavaFX (though to be honest I haven’t prototyped this). 
Unfortunately this means we can’t support the obvious use case of adding a 
translucent backdrop to a CSS-styled menu that uses a drop shadow.

I’m open to suggestions on how this feature should interact with CSS. Initially 
I thought that a stylesheet should be able to specify a backdrop but currently 
the CSS code only targets nodes for styling. It was also suggested that there 
should be media queries related to backdrops but I’m not sure what those would 
be.

The end result is a simple API which allows a developer to choose one of three 
backdrops for a stage. This needs to be expanded to future-proof it but before 
that can happen we need to sort out top-level issues like whether Win10 support 
is required, whether we need to support platform specific backdrops like glass 
on macOS, and how backdrops should interact with CSS. Thoughts, questions, and 
feedback welcome.

Martin

Reply via email to