-
Notifications
You must be signed in to change notification settings - Fork 892
Auto-detect HiDPI fractional scaling settings on Linux #8589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Thanks for this PR! So, to understand correctly, this handles fractional scaling (e.g. 150%) by using the 2x scaling at the AWT level (sun.java2d.uiScale), but then using FlatLAF's own scaling method (flatlaf.uiScale) to scale many, though not all, UI components down again by a bit less? The downside is that the UI still looks somewhat wonky, because only some components observe flatlaf.uiScale. On MacOS, fractional scalings are handled by the OS by scaling everything at 2x and then scaling down and anti-aliasing the entire image of the window, at the graphics card level. That tends to look much nicer. Is there no equivalent of that mechanism on GNOME/X that we can tap into? |
It does not look wonky to me with this PR.
I don't know. |
I emailed a GNOME developer, I will see if there's a way to do the down-scaling step at the compositing level instead. That would also have the advantage of working with multiple monitors, even if they have different desired scaling levels. |
I am using KDE Plasma, not GNOME. I don't have any interest in expanding the scope of this PR as described. This PR is a net improvement over the status quo, which doesn't support fractional scaling at all. It follows a method that has been tested and reported as successful by myself and two other users. I'm not willing to try implementing and/or testing a different approach. |
Sorry, I suspect the relevant settings are actually at the Wayland level, not specific to GNOME or KDE... I just suspect there exist people who might be able to immediately tell me if the compositing approach would work, and how to test it. |
If such an approach exists, I think that would be great information to share with anyone who is willing to try implementing and/or testing a different approach. As mentioned above, I am not willing to do so. |
@eirikbakke well, also XWayland level, which I believe has different configuration options for handling scaling too - automatic and application level? Given the range of parameters, and need to handle this right across X11 and XWayland, with potentially different settings, I have concerns about putting too much logic into the launchers themselves. See also #6185 etc. |
Perhaps, if fractional DPI is detected, we could just print a notice with a link to a Wiki page or such, listing options that have been tried and are known to work for different setups?
Yes, I was in the slow process of learning more about this. OpenJDK is indeed XWayland, not a full wayland app (yet). |
The current logic to auto-detect HiDPI settings on Linux from #3113 only handles the 2x case. This PR expands it to handle fractional scaling, as described in this thread.
Taking #7780 (comment) into consideration, the launcher does not touch the scaling settings if one or both of the
GDK_SCALE
andJ2D_UISCALE
environment variables is set.This PR was tested with both Java 17 and 21 (Eclipse Temurin) on Fedora 42 with fractional scaling enabled in KDE Plasma. Before this PR, no scaling was applied; after this PR, fractional scaling is applied and the following is logged:
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)