Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWayland DPI should always be 96 no matter which scaling settings are and which actual DPI displays have #3584

Closed
m-khvoinitsky opened this issue Feb 5, 2019 · 7 comments

Comments

@m-khvoinitsky
Copy link

  • XWayland DPI is autodetected based on random (?) plugged monitor on startup, does not changes at runtime (you may do it manually, though), has only one value per server no matter how many displays you have and how vary their DPIs (that's one of flaws of X11)
  • X11 clients render bigger fonts based on aforementioned DPI
  • Sway has its own scaling for each output and X11 windows get scaled twice
xdpyinfo | grep -B 2 resolution
screen #0:
...
  resolution:    118x118 dots per inch

Workaround: place the following on the top of your sway config:

exec --no-startup-id xrandr --dpi 96
  • Sway Version:
$ swaymsg -t get_version
sway version 1.0-rc1-8-ga1a99421 (Feb  4 2019, branch 'master')
@emersion
Copy link
Member

emersion commented Feb 5, 2019

This is an Xwayland bug: swaywm/wlroots#1119

Would be nice to understand what's going on in Xwayland's code.

@m-khvoinitsky
Copy link
Author

In my case, 118x118 dots per inch is an actual DPI of one of my displays, so it looks like something a bit different.

@m-khvoinitsky
Copy link
Author

m-khvoinitsky commented Feb 5, 2019

It seems that XWayland merely (as well as regular xorg server) gathers DPI from EDID which works fine if you have one display and a regular xorg server. But if you have a wayland compositor which scales windows according to their preferences and assuming that everything that comes from XWayland is 96 dpi, some issues happen.

So, the point is: if sway assumes that everything what comes from XWayland is 96 dpi, it should ensure that that everything what comes from XWayland is 96 dpi.

@emersion
Copy link
Member

emersion commented Feb 5, 2019

DPI != scale

DPI can be used by X11 clients to adjust their font size. However all X11 clients are well aware that they should render in LoDPI, and they do so.

In the end, this doesn't sound like a bug to me.

@m-khvoinitsky
Copy link
Author

DPI != scale

Well, ignoring custom user's preferences based on display proximity, vision, etc., in perfect setup, scale should be equal to display's DPI divided by 96 to get the same picture on different displays to be the same physical size. So, it's not the same, true, but they correlate.

However all X11 clients are well aware that they should render in LoDPI, and they do so.

That's not true. They do it for everything except for fonts. Try to exec, for example, xrandr --dpi 192 and then restart any of your X11 clients.

Probably, XWayland should not try to detect display's DPI and always use 96 in the first place. From that point, it may be considered as XWayland bug.

@emersion
Copy link
Member

emersion commented Feb 6, 2019

scale should be equal to display's DPI divided by 96 to get the same picture on different displays to be the same physical size

Scale matching DPI seems pretty unlikely.

That's not true. They do it for everything except for fonts. Try to exec, for example, xrandr --dpi 192 and then restart any of your X11 clients.

xrandr --dpi 192
env GDK_BACKEND=x11 gnome-calculator

works correctly for me.

@m-khvoinitsky
Copy link
Author

m-khvoinitsky commented Mar 16, 2019

So, after long, more careful testing, it seems that you're right: dpi changes happen on display hot plug, XWayland completely ignores setting dpi via xrandr hence the workaround doesn't work.
I'll try workaround proposed in #3499 (comment).
I guess we can close this issue in favor of swaywm/wlroots#1119.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants