8326428: [Linux] UI scaling factor cannot be fractional when using KDE
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
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
- [ ] Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)
Issue
- JDK-8326428: [Linux] UI scaling factor cannot be fractional when using KDE (Bug - P3)
Reviewers
- Lukasz Kostyra (@lukostyra - Reviewer)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1994/head:pull/1994
$ git checkout pull/1994
Update a local copy of the PR:
$ git checkout pull/1994
$ git pull https://git.openjdk.org/jfx.git pull/1994/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1994
View PR using the GUI difftool:
$ git pr show -t 1994
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1994.diff
Using Webrev
:wave: Welcome back mfox! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.
@beldenfox This change now passes all automated pre-integration checks.
ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.
After integration, the commit message for the final commit will be:
8326428: [Linux] UI scaling factor cannot be fractional when using KDE
Reviewed-by: lkostyra, mstrauss
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.
At the time when this comment was updated there had been 17 new commits pushed to the master branch:
- 14305d623144934f8b9c88e1ddf434ab51902857: 8330559: Trailing space not rendering correctly in TextFlow in RTL mode
- 8e49ea4af53376583e3cb9ce4288caa3f275ab93: 8318095: TextArea/TextFlow: wrong layout in RTL mode
- 32e667dfca9c5e9a19cb20f0bdd0553ca1ff765f: 8373193: RichTextArea: exceptions specifying position beyond the document end
- ... and 14 more: https://git.openjdk.org/jfx/compare/e2c4a7066c5ba5c232b7efc7210ac2e1a4a18da6...master
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.
Reviewers: @lukostyra @kevinrushforth
/reviewers 2
@kevinrushforth The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).
/integrate
Going to push as commit eaca75286abb43aa46fe6d0cd99c7938b649b3b3.
Since your change was applied there have been 17 commits pushed to the master branch:
- 14305d623144934f8b9c88e1ddf434ab51902857: 8330559: Trailing space not rendering correctly in TextFlow in RTL mode
- 8e49ea4af53376583e3cb9ce4288caa3f275ab93: 8318095: TextArea/TextFlow: wrong layout in RTL mode
- 32e667dfca9c5e9a19cb20f0bdd0553ca1ff765f: 8373193: RichTextArea: exceptions specifying position beyond the document end
- ... and 14 more: https://git.openjdk.org/jfx/compare/e2c4a7066c5ba5c232b7efc7210ac2e1a4a18da6...master
Your commit was automatically rebased without conflicts.
@beldenfox Pushed as commit eaca75286abb43aa46fe6d0cd99c7938b649b3b3.
:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.