8326428: [Linux] UI scaling factor cannot be fractional when using KDE #1994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The standard way to determine the user interface scaling factor on Linux is to consult the reported monitor DPI and divide by 96 (which is also the way it's done on Windows). This allows the scaling factor to vary per-monitor and also achieve fractional values.
Before this became the standard the Gnome toolkit communicated the scaling factor using the "GDK_SCALE" environment variable or the "org.gnome.desktop.interface" "scaling-factor" gsetting. These were always integer values (no fractional scaling) and applied to all monitors. They became the de-facto way of communicating the scaling factor and were picked by various toolkits including JavaFX. They are now obsolete within Gnome.
JavaFX will compute correct per-monitor scaling factors if GDK_SCALE and "scaling-factor" aren't set. Gnome no longer sets these but unfortunately the KDE desktop does in an attempt to get certain apps to scale (one bug report specifically called out IntelliJ). In KDE for Ubuntu 24 the "scaling-factor" is always set to the floor of the actual scaling factor which is preventing JavaFX from computing fractional scales. Either setting will prevent JavaFX from computing per-monitor scales.
This PR changes the priority of the ui scale tests. As always, the JavaFX "glass.gtk.uiScale" setting takes precedence. If that's not set the system uses the scaling computed based on the monitor DPI. It only consults the legacy settings if the reported DPI is 96.
Ignoring GDK_SCALE is problematic since there are certainly users who use this as a convenient way to influence JavaFX (if only to work around this bug). If we want to provide an environment variable for them we should create our own and not rely on the legacy variables of other toolkits.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1994/head:pull/1994$ git checkout pull/1994Update a local copy of the PR:
$ git checkout pull/1994$ git pull https://git.openjdk.org/jfx.git pull/1994/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1994View PR using the GUI difftool:
$ git pr show -t 1994Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1994.diff
Using Webrev
Link to Webrev Comment