! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Displays.c hardcodes the dpi to 96
Status:
RESOLVED: DUPLICATE
Product:
Xfce4-settings
Component:
Xfsettingsd

Comments

Description Damien.Olivier.Robert+bugzilla 2018-02-20 23:50:35 CET
In `xfce_displays_helper_normalize_crtc` the dpi is forced to be 96. I
understand that gtk (unlike recent versions of QT) lacks a mean to configure
different dpis for the different xrandr monitors, but
1) when there is only one monitor the dpi reported by that monitor is way
better than 96 (since a lot of monitors are HiDPI these days)
2) even when there are several monitors, the min of their dpis (or the dpi
of the primary display) would be better than hardcoding it to 96.
3) this overrides the size of my monitor that I set in .xprofile:

# Correct dpi (*sigh*)
# https://bugs.freedesktop.org/show_bug.cgi?id=23705

# Find the real dimension of the primary display and set it
size="$(xrandr | sed -n '/ connected primary / {s/.* \([0-9]\+\)mm x \([0-9]\+\)mm/\1x\2/p;q}')"
[ -z "$size" ] && size="$(xrandr | sed -n '/ connected / {s/.* \([0-9]\+\)mm x \([0-9]\+\)mm/\1x\2/p;q}')"
[ -n "$size" ] && xrandr --fbmm $size
#TODO this is overrided by xfsettingsd which put the dpi back to 96

4) X already hardcodes the screen mm size to get 96dpi, cf the bug 23705
above. So the code of display.c that hardcodes the dpi to 96 too changes
nothing, except for the users like me who try to get a sensible dpi by
calling xrandr --fbmm with the correct size.


There are two solutions:
1) The first easy one is to simply remove helper->{mm_width,mm_height}.
This should change nothing for users who don't set their screen size
themselves because X already hardcodes the screensize to 96dpi.
2) The second one would be to further change the logic of xsettings.c so
that the xsettings Xft.dpi is set to a better value.

Currently the dpi logic of xsettings.c is quite sound: if Xft.dpi <1 (this
happen by default since the default value is -1), xsettings.c uses the dpi
value computed from the screen (in xfce_xsettings_helper_screen_dpi). The
only problem once again is that since X hardcodes {Width,Height}OfScreen to
have 96dpi, the autodetected dpi value provided by xsettings.c is valid
only for users who configure their xorg.conf to set the screen size to the
correct value (or use xrandr --fbmm), the other users will get the hardcoded 96dpi.

From what I understand from the comments for X bug 23705, the X developpers
consider it is the role of the wm and not of the Xsever to correctly handle
dpi when there are xrandr  monitors. It is indeed the only way to get the
correct dpi across different monitors: the wm keeps track on which desktop
the window is and update the dpi dynamically. (This is what windows 7+ is
doing, ironically they went from hardcoded 96 dpi to dynamic dpi while Xorg
went from autodetected dpi to hardcoded 96 dpi...) But I understand this is
out of scope for xfce since gtk lacks any support for that. Still setting
the Xft.dpi to a more sensible value than the hardcoded X 96dpi one would
help (as I suggested: taking the minimal dpi of the monitors, or the dpi of
the primary monitor).

(By the way this is out of topic for this bug, but if you decide to
implement automatic HiDPI detection like gnome does (by setting
Gdk/WindowScalingFactor to 2 when the dpi is >= 192 and screen height is >
1200pixels), then xsettings.c will also need to export Gdk/UnscaledDPI to
real_dpi/WindowScalingFactor in order to prevent a double scaling for
fonts).

Thanks!
Comment 1 Glen Whitney 2020-05-13 18:39:43 CEST
This appears to be a duplicate of issue #10633.
Comment 2 Skunnyk editbugs 2020-05-13 22:37:59 CEST

*** This bug has been marked as a duplicate of bug 10633 ***

Bug #14236

Reported by:
Damien.Olivier.Robert+bugzilla
Reported on: 2018-02-20
Last modified on: 2020-05-13

People

Assignee:
Nick Schermer
CC List:
4 users

Version

Version:
4.12.1

Attachments

Additional information