Hacker News new | ask | show | jobs
by gurkendoktor 1925 days ago
Besides security concerns, mixed-DPI setups are such a major pain point with X11 that many people who use a laptop with additional screens would probably switch to Wayland just for that alone. That's a large demographic.
2 comments

Do any desktop system handle mixed DPI well?

I mainly use Linux so I don't know, but one of my work laptops have windows on it and it freaks out every time I connect it to a 4k monitor.

At least in linux I can use triggers and xrandr [1] to manage it even if it's not pretty, never figured out how to do it automatically in windows.

Edit: I am using KDE/Qt apps for 99% of my gui stuff. Gnome etc might be worse.

[1] http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/#therandrway

> Do any desktop system handle mixed DPI well?

MacOS handles it very well, moving a window from a high-DPI display to a low-DPI display works perfectly.

I'm not sure about how Windows handles mixed-DPI, but it handles DPI changes mostly OK. I only access my Windows machines via RDP, so sometimes they get a high-DPI display and sometimes they get a low-DPI one. Apart from one program (there are per-program settings available in Windows to help fix scaling issues) everything seems to handle it fine.

IIUC the macOS approach is functional but not perfect. I believe it renders all apps at a high resolution (higher than the highest attached display), then the compositor downscales them to the display. This means that apps are using more resources to render and are unable to render pixel-perfect.

I believe that on Wayland the apps are told the scaling factors of the monitors that they are on (or the compositor can scale them if they don't want to switch resolution or are across multiple monitors).

AFAIK apps can't work around this very easily (if at all).

IME mixed DPI under Windows is a mixed bag, with behavior varying on an app to app basis. For instance Telegram (Qt) can’t deal with being moved from one screen to the other and will look either tiny or huge, but most Win32 and WinUI apps work just fine.

This distinction doesn’t exist on macOS for the most part, even “foreign” UI libraries will appear the correct size when changing screens.

Anecdotally both macOS and Windows have handled mixed DPI just fine for me.
> Do any desktop system handle mixed DPI well?

This works today out-of-the-box in Wayland as long as the applications are Wayland native (e.g.: not being run through XWayland).

This is a major pain with the current generation of Electron apps, but luckily the newest version supports Wayland.

HiDPI is also in the works for XWayland, but it looks complicated and still a few months out.

Windows handles it perfectly (anecdotal). Not sure what do you mean by freaking out.
Probably how the scaling is off while you drag windows from/to hidpi displays. The scaling is only adjusted once the pointer moves to the other display.

At least that's how it was for me when I used a high dpi display (160 dpi) 2 yrs ago. (I switched back to 90dpi at some point, so they might have improved it by now)

Mac OS X handles this by rendering everything at some insane resolution and the scaling just before displaying
That only applies for non-integer scales. If you run at clean 2x or 3x everything is drawn at native scale, unless the app doesn’t support HiDPI in which case it’s drawn at 1x and scaled up.
This explains why non integer looks so good.
Works perfectly on Wayfire and I assume Sway.

I briefly tried out Gnome and KDE, with the former "meh" (no fractional scaling, scaling glitches when dragging between displays) and the latter garbage (couldn't find scaling settings at all, so nothing is readable on the laptop display).

Widows is between "okay" and "nice" (somewhat fractional scaling, glitches between displays, some wrong scalings, but it's rare).

I haven't tried macOS yet, but expect it to be flawless, like or slightly better than the experience on Wayfire.

Fwiw, System Settings -> Display has the per-screen scale settings.

My wife got a 4K desktop screen for her FHD laptop a few months ago and it made us switch her system to Plasma's Wayland session. Mixed DPI works fine, also dynamically (i.e. dock/undock).

KDE scaling settings are pretty obviously in the Display Settings page so I'm going to say that one is user failure.
This is not the fault of X11 since it exposes all necessary data via the xrandr extention[1]. It is just toolkits like Gtk that choose to ignore that information on X11 but not on Wayland.

1.: http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/