JDK-8160194 : [hidpi] Ubuntu 16.04: Screen.getOutputScaleX(), Screen.getOutputScaleY() do not respect user-defined scale
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2016-06-23
  • Updated: 2018-09-05
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 :  
just some echo of JDK-8156981.

JDK9 b123 + Ubuntu 16.04 Linux (Unity) + HiDPI

please run the following code:

import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.stage.Stage;
import javafx.stage.Screen;

public class ScreenTest extends Application {

    public void start(Stage stage) throws Exception {

        ObservableList<Screen> screens = Screen.getScreens();

        for (Screen s: screens) {
            System.out.println("\n" + s.toString());
            System.out.println("dpi: " + s.getDpi());
            System.out.println("scale x: " + s.getOutputScaleX());
            System.out.println("scale y: " + s.getOutputScaleY());


the output for the scales will always be 1 (if GDK_SCALE wasn't set previously). The user-defined scale from "Settings->Display" will be ignored.
An up to date version of Ubuntu 16.04 should contain all of the necessary schemas and keys for us to make the determination. Is this still reproducible? Does it reproduce if you update the software using the software updater?

We need the proper version of libraries to be able to query the setting. Try running a build with wrapper_debug in wrapper_main.c set and see if it is finding the necessary interfaces to programmatically query the values. In particular, does your libgio library have definitions for all of the following? g_settings_schema_source_get_default g_settings_schema_source_lookup g_settings_schema_has_key g_settings_new g_settings_get_uint If it is missing any of those then we cannot query the settings API for the scaling-factor key...

(on Win. 10 + HiDPI works as expected)

the current instruction gsettings set org.gnome.desktop.interface scaling-factor 2 doesn't affect the output as well