Menu

#5961 HiDPI display not supported

open
nobody
None
5
2020-02-04
2019-12-02
No

Hello! Stendhall not running correctly on HiDPI diplays, text and menu are very small.

https://wiki.archlinux.org/index.php/HiDPI

Discussion

  • Hendrik Brummermann

    Hello Alexey,

    that page says "Since Java 9 the GDK_SCALE environment variable is used to scale Swing applications accordingly. "

    Which Java version are you using?

    Does it work to set the scale factor manually as documented on that page?

     
  • Alexey Kuznetsov

    I'm using Ubuntu and openjdk 11.0.5 2019-10-15, GDK_SCALE=2 works fine, but I expect java to set default.

     
  • Anonymous

    Anonymous - 2020-01-23

    I dig a little bit, to get current monitor scale is required to use dbus, simple python script shows how:

    https://gitlab.com/Oschowa/gnome-randr/blob/master/gnome-randr.py

     
  • Anonymous

    Anonymous - 2020-01-25

    Here two solutions, first bash one, second using java dbus interface (linux only, windows and mac works fine). I reported this behaviour to openjdk, since it is only linux related issue, not sure if it ever be fixed, maybe it is a designed behaviour.

    #!/bin/bash
    
    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;}}}')
    
    GDK_SCALE=$HIDPI javaws -headless https://stendhalgame.org/stendhal.jnlp
    

    Using display library LinuxDisplay.getScale()

    https://gitlab.com/axet/desktop/blob/dev/java/src/main/java/com/github/axet/desktop/os/linux/LinuxDisplay.java

     
  • Anonymous

    Anonymous - 2020-01-26

    I've check the code, something like this in stendhal Starter.java should solve HIDPI issue:

            import com.github.axet.desktop.linux.LinuxDisplay;
    
            if (System.getProperty("sun.java2d.uiScale") == null && System.getenv("GDK_SCALE") == null) {
                try {
                    System.setProperty("sun.java2d.uiScale", LinuxDisplay.getScale());
                } catch (Exception ignore) {
                }
            }
    
     
  • Anonymous

    Anonymous - 2020-01-26

    "if" line suppose to be:

    System.getProperty("sun.java2d.uiScale") == null && System.getenv("GDK_SCALE") == null && System.getProperty("os.name").equals("Linux")
    
     
  • Anonymous

    Anonymous - 2020-02-04
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB