On Mon, 1 Dec 2025 17:57:30 GMT, Martin Fox <[email protected]> wrote:

> 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.

Reviewers: @lukostyra @kevinrushforth

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1994#issuecomment-3598417881

Reply via email to