Skip to content

xwayland: Add HiDPI support to Xwayland rootful

As we all know too well, Xwayland does not play nice with HiDPI or even fractional scaling in Wayland.

The reason for this is that Xwayland always applies the same scale 1 to all its surfaces, regardless of the actual scale specified by the Wayland output.

This is unfortunately necessary because Xwayland is an X11 server and all X11 clients running on a Wayland desktop share the same Xwayland rootless server, so it's impossible to have mixed scaled between different X11 clients depending on which output they reside (see #1318 for my take on this).

But the same limitation about mixed DPI does not apply to rootful Xwayland, since all X11 clients running on a rootful Xwayland are visually placed on the same visible root window, so we could just resize the root window depending on the output scale, like any other Wayland client does.

That means that moving the rootful window from an output with scale 1 to another output with scale 2 would trigger an XRandR reconfiguration.

Of course X11 clients would need to adjust their rendering scale accordingly, so this also includes a property on the root window _XWAYLAND_SCALE that X11 client can use the adjust their rendering scale (or more likely a small daemon reflecting the value exposed from _XWAYLAND_SCALE to the relevant mechanisms used by the X11 toolkits).

With this, X11 clients capable of rendering their UI at different scales (such as Qt or GTK) could adjust their rendering to the scale of the Wayland output the rootful Xwayland is placed on, dynamically.

In a sense, it is similar to what other merge requests such as !111, !432 or !733 do, but limited to rootful Xwayland and with the scale automatically adjusted depending on the output scale.

Edited by Olivier Fourdan

Merge request reports