Skip to content

Fix splash screen transparency on Linux - #4847

Merged
cwisniew merged 2 commits into
RPTools:developfrom
kwvanderlinde:bugfix/4819-splash-screen-transparency-on-linux
Jun 28, 2024
Merged

Fix splash screen transparency on Linux#4847
cwisniew merged 2 commits into
RPTools:developfrom
kwvanderlinde:bugfix/4819-splash-screen-transparency-on-linux

Conversation

@kwvanderlinde

@kwvanderlinde kwvanderlinde commented Jun 27, 2024

Copy link
Copy Markdown
Collaborator

Identify the Bug or Feature request

Fixes #4819

Description of the Change

The SplashScreen has been refactored to be entirely Swing-based instead of relying on JFXPanel, since combining a transparent JFXPanel with a transparent JFrame does not work properly on X. JavaFX is still used to generate the splash image, but the image is displayed in a regular JPanel.

Possible Drawbacks

I could only verify the changes on a few configurations: Windows 11 (still works), Linux Mint 21.3 with Cinnamon (fixed), and OpenSuse Tumbleweed with KDE Plasma 6.0 (fixed). Would be good to at least get a Mac test as well.

Documentation Notes

N/A

Release Notes

  • Fixed a bug where the splash screen did not have transparent edges on Linux

This change is Reviewable

JavaFX initialization is no longer the implicit responsibility of `SplashScreen` but is instead done explicitly in
`MapTool.main()`.

The `CreateVersionedInstallSplash` JavaFX application is no more, with tis vital functionality now merged into
`SplashScreen`.
The problem is that while `JFrame` supports per-pixel transparency, and `JFXPanel` also supports transparency,
`JFXPanel` refuses to be transparent if used in a transparent `JFrame`. But we don't need a `JFXPanel` here since we're
just displaying an image, so it has been replaced with a `JPanel` that does exactly that and no more.

It was also necessary to be a bit more particular in how `SplashScreen` is initialized. We must get the screen
dimensions _after_ `setUndecorated()` and `setType()`, and must call `setLocationRelativeTo(null)` after setting the
windw bounds. The reasons are not entirely clear, but may be related to weaknesses in window transparency for
multi-monitor setups on X.

`SplashScreen` is also not responsible for setting its own visibility. The caller decides when to do that now. We can
also greatly limit the portion of `SplashScreen` that needs to run on the JavaFX thread now that we only use JavaFX for
generating the image.
@kwvanderlinde kwvanderlinde self-assigned this Jun 27, 2024
@cwisniew
cwisniew added this pull request to the merge queue Jun 28, 2024
Merged via the queue into RPTools:develop with commit 84072c9 Jun 28, 2024
@kwvanderlinde
kwvanderlinde deleted the bugfix/4819-splash-screen-transparency-on-linux branch June 28, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Merged

Development

Successfully merging this pull request may close these issues.

[Bug]: Splash screen does not have transparency on Linux

2 participants