You are not logged in.

#1 2020-03-22 16:50:06

ith140
Member
From: Ottawa, ON
Registered: 2005-07-13
Posts: 32

HiDPI and Tk and other xwindow type applications

I've got a question that has stumped me regarding the configuration of my 4k machine. I'm using KDE with X11 (not wayland) and I have 99% of applications looking great (UI scaling works well). However, I have a some other applications that don't. One is a Tk application (proprietary, no access to source code), and another good example is something like VASSAL from the AUR which uses Java, I think.

I know I can use xrandr to scale the whole screen so that I can actually see/use these applications (at the price of distorting Plasma desktop), but it seems like there should be a better way without this hack approach. I've looked at the wiki regarding the .Xresources file, but if this is an option I still feel lost.

Thanks for any guidance and advice!

Offline

#2 2020-03-22 17:03:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: HiDPI and Tk and other xwindow type applications

You are likely forcing QT/KDE applications to scale to adjust to an incorrectly reported X server DPI or size.  If you do that, you will need to adjust every toolkit, and at present TK does not have an option for this (unless you are writing the code yourself; there is a scaling factor that can be applied).  Java will depend on which version of Java you are using.

The better solution is not actually xrandr, but related.  The problem is if you adjust KDE to cope with incorrectly reported DPI values, then change the DPI values with xrandr, of course KDE will look bad.  Just fix it once at the lowest level (X11) and leave everything else alone.

What is the output of `xdpyinfo | grep -B 2 resolution`?  And what is the actual size of your screen (measured with a tape measure or ruler)?

Last edited by Trilby (2020-03-22 17:04:07)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2020-03-22 18:07:09

ith140
Member
From: Ottawa, ON
Registered: 2005-07-13
Posts: 32

Re: HiDPI and Tk and other xwindow type applications

screen #0:
  dimensions:    3840x2160 pixels (512x288 millimeters)
  resolution:    191x191 dots per inch

with my actual screen being:
346x195 mm

So there is some mismatch, however xrandr reports the size as 345mm x 194mm.

Last edited by ith140 (2020-03-22 18:14:13)

Offline

#4 2020-03-22 18:30:35

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: HiDPI and Tk and other xwindow type applications

The dimension given by xdpyinfo is calculated from configured DPI and resolution. Your physical DPI should be about +/-280, the closest multiple of 96 (the default dpi on linux) would be 288 (3x96)

192dpi would be 2x96.

Last edited by progandy (2020-03-22 18:34:42)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#5 2020-03-22 20:01:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: HiDPI and Tk and other xwindow type applications

You can set your actual screen size in an xorg.conf file, e.g., here's mine:

Section "Monitor"
	Identifier             "eDP-1"
	DisplaySize            308 173
EndSection

DPI will then be calculated appropriately.

Progandy, there should be no need for DPI to be multiples of anything - just set the proper screen size.

Last edited by Trilby (2020-03-22 20:02:16)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2020-03-23 00:27:50

ith140
Member
From: Ottawa, ON
Registered: 2005-07-13
Posts: 32

Re: HiDPI and Tk and other xwindow type applications

Thank you for the help so far, but I the suggestions thus far don't help.  This shows my problem:

https://drive.google.com/open?id=1_Nz8e … ht7LqDFG6y

The menu and text in the Java application are so small compared to a normal KDE window.

Offline

#7 2020-03-23 00:29:15

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: HiDPI and Tk and other xwindow type applications

And what have you actually done?  Has the output of xdpyinfo changed?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2020-03-23 00:49:36

ith140
Member
From: Ottawa, ON
Registered: 2005-07-13
Posts: 32

Re: HiDPI and Tk and other xwindow type applications

I added to xorg.conf:

Section "Monitor"
        Identifier             "eDP-1-1"
        DisplaySize            345 194
EndSection

xdpyinfo output is unchanged with respect to my display dimensions. Here is my xorg.conf file:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 418.56

Section "ServerLayout"
    Identifier     "Default Layout"
    Screen         "Default Screen" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Module"
    Load           "modesetting"
    Load           "glx"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "Device"
    Identifier     "nvidia"
    Driver         "nvidia"
EndSection

Section "Screen"
    Identifier     "Default Screen"
    Device         "nvidia"
    DefaultDepth    24
    Option         "AllowEmptyInitialConfiguration"
    SubSection     "Display"
        Depth       24
        Modes      "nvidia-auto-select"
    EndSubSection
EndSection

Section "Monitor"
	Identifier             "eDP-1-1"
	DisplaySize            345 194
EndSection

Last edited by ith140 (2020-03-23 00:52:12)

Offline

#9 2020-03-23 05:59:08

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: HiDPI and Tk and other xwindow type applications

Java applications seems to have their own switches or use GDK_SCALE
https://wiki.archlinux.org/index.php/Hi … plications
You could probably set them with _JAVA_OPTIONS?


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#10 2020-03-23 12:28:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: HiDPI and Tk and other xwindow type applications

Is your output actually called "eDP-1-1"?  What's the output of `xrandr`?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2020-03-23 13:27:03

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,392

Re: HiDPI and Tk and other xwindow type applications

I suggest you put those settings in a separate file under /etc/X11/xorg.conf.d , called something like 90-monitor-mybrand-mymodel.conf .
That will prevent autoconfigure stuff from messing up your DPI settings.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#12 2020-03-23 14:16:53

ith140
Member
From: Ottawa, ON
Registered: 2005-07-13
Posts: 32

Re: HiDPI and Tk and other xwindow type applications

Here's the output of xrandr, so I believe my display is eDP-1-1:

Screen 0: minimum 8 x 8, current 3840 x 2160, maximum 32767 x 32767
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
eDP-1-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 345mm x 194mm
   3840x2160     60.02*+  60.00    60.01    59.98    40.05    59.97  
   3200x1800     59.96    59.94  
   2880x1620     59.96    59.97  
   2560x1600     59.99    59.97  
   2560x1440     59.99    59.99    59.96    59.95  
   2048x1536     60.00  
   1920x1440     60.00  
   1856x1392     60.01  
   1792x1344     60.01  
   2048x1152     59.99    59.98    59.90    59.91  
   1920x1200     59.88    59.95  
   1920x1080     60.01    59.97    59.96    59.93  
   1600x1200     60.00  
   1680x1050     59.95    59.88  
   1400x1050     59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1280x800      59.99    59.97    59.81    59.91  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   640x400       59.88    59.98  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32

The VASSAL java application, is unfortunately java8, so it may not support scaling from what I've read.

Last edited by ith140 (2020-03-23 20:26:30)

Offline

#13 2020-03-24 00:11:54

YCH
Member
Registered: 2014-01-28
Posts: 53

Re: HiDPI and Tk and other xwindow type applications

Xft.dpi: 283

try this on ~/.Xresources.


YCH

Offline

Board footer

Powered by FluxBB