JDK-8238077 : HiRes displays not equally handled on linux/windows/osx
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: openjfx13
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: x86
  • Submitted: 2020-01-23
  • Updated: 2020-08-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Related Reports
Relates :  
Hello! If you run java on HiRes display it works correctly on windows and osx but requires additional configuration to run on linux machines, which, I assume, make is a bug. If you check this article: https://wiki.archlinux.org/index.php/HiDPI you can see java understand GDK_SCALE environment variable to scale graphics in java applications. But, same java instances works prefectly fine on windows and osx bug failed (required correctly configured GDK_SCALE variable) on linux.

It can be handled manually, by creating java dbus client interface reader and assiging correct GDK_SCALE variable at runtime, but it feels a platform job. You can see how to work with dbus as simple python example https://gitlab.com/Oschowa/gnome-randr/blob/master/gnome-randr.py

Additional Information: I wrote shell and java examples library working with dbus, here it is: HIDPI=$(dbus-send --session --print-reply --dest="org.gnome.Mutter.DisplayConfig" /org/gnome/Mutter/DisplayConfig org.gnome.Mutter.DisplayConfig.GetCurrentState | awk '/string +"legacy-ui-scaling-factor"/{while(1){getline line;if(match(line,/variant +int32 +([0-9]+)/,m)){print m[1]; break;}}}') import com.github.axet.desktop.linux.LinuxDisplay; if (System.getProperty("sun.java2d.uiScale") == null && System.getenv("GDK_SCALE") == null && System.getProperty("os.name").equals("Linux")) { try { System.setProperty("sun.java2d.uiScale", LinuxDisplay.getScale()); } catch (Exception ignore) { } } https://gitlab.com/axet/desktop/-/blob/master/java/src/main/java/com/github/axet/desktop/os/linux/LinuxDisplay.java