splashscreen protocol

Philip Race philip.race at oracle.com
Thu May 23 20:42:31 UTC 2024


w.r.t the discussion we had about the Wayland splash screen protocol 
proposal and whether it might work for JDK/AWT
splash screen's need for centering a window.

- Usage of splash screen looks like "java -splash:myimage.png MyJavaApp"
- That image is displayed in a "native" window (ie not an AWT one) and 
that is a "raw" XWindow on Linux today
and I suppose would be  something like an XDG toplevel with wayland.
- That 'native' splash window is shown before the VM is running (ie 
before any classes are loaded / Java code is running)
-  It is the same native window that is indirectly exposed in the AWT 
SplashScreen API
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/awt/SplashScreen.html
- Note that apps CANNOT get a direct reference to the window, so they 
are entirely limited by the SplashScreen API
- Applications can composite rendering on to that window by getting a 
"Graphics" instance and draw to that and
    then make a call update() the splash contents
- The window is definitely "output only", so I think that part fits into 
the proposed protocol.
- The fairly limited rendering you can do means that applications which 
want to do more, typically put up a new AWT window
  in the same exact location and with the same size.
- SplashScreen does have a "getBounds()" API which returns the x/y and 
w/h of the window.
- Applications can then use that to create their window, which when 
displayed automatically causes the splash window
    to be hidden.

I think in the context of the usual Wayland policies that "getBounds" 
might be the tricky part. The X/Y part that is.
Although in many cases we could probably calculate it IIUC 
xdg_output.logical_size will give us
overall bounds of a device and if we know the w/h of our window - then 
it should be
simple arithmetic to calculate the X/Y .. and assuming most Wayland apps 
know how big a splash window they created
they can do the same .. and so perhaps there's no reason for the splash 
screen protocol to try to "hide" this information.

In summary, a simple splash screen protocol that supports centering 
would probably work for JDK/AWT.

-phil.






More information about the wakefield-dev mailing list