You are not logged in.

#1 2025-03-08 22:50:43

kero
Member
Registered: 2012-08-26
Posts: 57

[solved] Xorg DPI / DisplaySize settings modified by LXDM/XFCE/GTK

Hello everybody.

I just bought an Asus Tuf VG34VQL3A ultrawide screen. My screen has a size of 797.22mm*333.72mm, for a resolution of 3440*1440 (and then, a theorical DPI of 110). Xorg doesn’t natively sets this DPI by itself (which, as far as I understood, is normal)and uses the standard DPI value of 96, which is confirmed by this :

keikoz@kdesktop ~ $ xdpyinfo | grep -B2 resolution
screen #0:
  dimensions:    3440x1440 pixels (911x382 millimeters)
  resolution:    96x96 dots per inch

Wrong size and wrong DPI. That’s why I am trying to set the correct DPI setting in Xorg (following the procedure described there: https://wiki.archlinux.org/title/Xorg#D … ze_and_DPI), by giving the correct size in a /etc/X11/xorg.conf.d/90-monitor.conf file:

keikoz@kdesktop ~ $ cat /etc/X11/xorg.conf.d/90-monitor.conf 
Section "Monitor"
    Identifier             "DP-1"
    DisplaySize            797 334
EndSection

This configuration looks as being basically correct: indeed, if I start xorg with xinit, the DPI and size are correct:

keikoz@kdesktop ~ $ xdpyinfo | grep -B2 resolution
screen #0:
  dimensions:    3440x1440 pixels (797x334 millimeters)
  resolution:    110x110 dots per inch

But when I start (as I usually do) with the sequence lxdm.service -> xfce, those settings are uncorrectly modified:

keikoz@kdesktop ~ $ xdpyinfo | grep -B2 resolution
screen #0:
  dimensions:    3440x1440 pixels (911x382 millimeters)
  resolution:    96x96 dots per inch

So it looks that something (else than xorg) is modifying the initial (correct) settings. I suspect LXDM/XFCE/GTK but from there on, I can't find the right way to solve this.

Any idea ?

Last edited by kero (2025-03-12 12:42:21)

Offline

#2 2025-03-09 09:01:50

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,783

Re: [solved] Xorg DPI / DisplaySize settings modified by LXDM/XFCE/GTK

https://wiki.archlinux.org/title/LXDM#Configuration
https://wiki.archlinux.org/title/Xorg#D … ze_and_DPI (see the commandline parameter, the logical dimensions in xdpyinfo are calculated from the root window size and a given DPI - check "xrandr -q" to what the server thinks the physical resolutions are. inb4: the reason is that X11 was a netwrok protocol that could also color pixels wink )
In doubt squeeze an "xrandr --dpi 110" into one of lxdm's scripts.

Also check "DISPLAY=:0 xdpyinfo" from a console while LXDM is running but before logging in to get an idea at which state this is overridden.

Offline

#3 2025-03-09 11:06:26

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,845

Re: [solved] Xorg DPI / DisplaySize settings modified by LXDM/XFCE/GTK

GTK overrides the server DPI setting using Xft.dpi . The only way to prevent that is to set it yourself .

See https://wiki.archlinux.org/title/Xorg#M … ing_Caveat for details and a method to verify if that's the issue on your system.


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

Online

#4 2025-03-09 14:59:35

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,783

Re: [solved] Xorg DPI / DisplaySize settings modified by LXDM/XFCE/GTK

the xft rdb entry might impact the font rendering of gtk (and Qt6, since a couple of versions…) but rather not the server DPI (unless some gtk client gets it from there and changes the server accordingly but that doesn't necessarily fit "doesn't happen w/ xinit")

Offline

#5 2025-03-10 17:32:33

kero
Member
Registered: 2012-08-26
Posts: 57

Re: [solved] Xorg DPI / DisplaySize settings modified by LXDM/XFCE/GTK

Hello guys,

Thank you for your answers. That gave me several directions in which to narrow my search and finally, I think that I found the main "issue" (if it is an issue).

The culprit is xfsettingsd (shipped via the package xfce4-settings), the settings handler of XFCE, which sets the DPI to a standard 96, whatever the monitor size. The problem is well described there: https://unix.stackexchange.com/question … i-settings (including a link to the concerned code).

I have a confirmation of this by:
- killing xfsettingsd
- resetting the DPI via "xrandr --dpi 110"; after that, xdpyinfo shows a correct DPI
- relaunching xfsettingsd in debug mode (as described there: https://docs.xfce.org/xfce/xfce4-settings/xfsettingsd)
- xdpyinfo now shows again an incorrect DPI of 96

So now, it looks that the only solution would be hacking the xfsettingsd code to prevent it of changing the DPI setting. Which is boring (I would have to maintain a hacked packet), which leads me to wonder whether this is necessary/useful ?

Also to know: XFCE configuration allows to set (correctly) the Xft.dpi setting (Settings manager -> Appearance -> Fonts -> Custom DPI). At a first sight, modifying this setting scales everything at the "right" size. So, right at the moment in my desktop, the xorg’s DPI setting is 96 (as shows "xdpyinfo"), but Xft.dpi is 110 (as shows "xrdb -query" info). Now, I don’t know if this setting guarantees a complete and correct handling of the real DPI by all softwares.

Opnions ?

Last edited by kero (2025-03-10 17:33:23)

Offline

#6 2025-03-10 21:04:37

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,783

Re: [solved] Xorg DPI / DisplaySize settings modified by LXDM/XFCE/GTK

xft is a font rasterizer, everything using it (or caring about that server resource) will properly scale fonts, but if clients query the logical resolution, they'll get the wrong one.
(Other clients might query the physical resolution via randr and be fine)

https://wiki.archlinux.org/title/HiDPI

The code mentioned in the SE link isn't in the master branch, https://github.com/xfce-mirror/xfce4-se … displays.c and https://wiki.archlinux.org/title/HiDPI#Xfce there seems to be a config option for the resolution.

Offline

#7 2025-03-11 21:27:54

kero
Member
Registered: 2012-08-26
Posts: 57

Re: [solved] Xorg DPI / DisplaySize settings modified by LXDM/XFCE/GTK

seth wrote:

xft is a font rasterizer, everything using it (or caring about that server resource) will properly scale fonts, but if clients query the logical resolution, they'll get the wrong one.
(Other clients might query the physical resolution via randr and be fine)

Ok, thank you for explanations.

seth wrote:

The code mentioned in the SE link isn't in the master branch, https://github.com/xfce-mirror/xfce4-se … displays.c

Ok, right. I didn’t notice that.

seth wrote:

and https://wiki.archlinux.org/title/HiDPI#Xfce there seems to be a config option for the resolution.

I just had a look on that procedure. With those settings, it is only possible to scale x2, which is like having a DPI of 192. Which is definitely to much.

Anyway. By reading on XFCE forums, it looks like these DPI issue is pointed out by a lot of users. To note especially the following discussion of the issue: https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/34

Last edited by kero (2025-03-11 22:01:57)

Offline

#8 2025-03-12 07:52:57

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,783

Re: [solved] Xorg DPI / DisplaySize settings modified by LXDM/XFCE/GTK

Sounds like that's just the (non-fractional) GDK_SCALE setting then.
Since the primary focus is likely font sizes and most clients won't track the server dpi (ie "xrandr --dpi whatever" will only affect new processes) hardcoding the xft dpi and running "xrandr --dpi 110" with some autostart script will likely mitigate most cases - as inelegant as it may be (but the upstream bug is open for a decade now…)

Offline

#9 2025-03-12 12:40:59

kero
Member
Registered: 2012-08-26
Posts: 57

Re: [solved] Xorg DPI / DisplaySize settings modified by LXDM/XFCE/GTK

seth wrote:

Sounds like that's just the (non-fractional) GDK_SCALE setting then.
Since the primary focus is likely font sizes and most clients won't track the server dpi (ie "xrandr --dpi whatever" will only affect new processes) hardcoding the xft dpi and running "xrandr --dpi 110" with some autostart script will likely mitigate most cases - as inelegant as it may be (but the upstream bug is open for a decade now…)

Indeed. I was even considering trying a new DE but globally, I like XFCE and the faulty xorg’s DPI setting doesn’t harm me really, so I wiil stick with it. That’s why I consider adopting the xrandr/autostart solution. By "hardcoding" Xft.dpi, I suppose you mean by putting it into ~/.Xresources as explained in the link you pointed out.

I suppose that further discussion on that question should go in XFCE’s gitlab from now on, so I mark this discussion as "solved".

Thank you a lot for all the help and explanations.

Offline

Board footer

Powered by FluxBB