Skip to content

wayland/output: Report unscaled size even in logical layout mode

In physical layout mode, the size and scale of the wl_output matches the actual monitor:

Monitor wl_output GdkMonitor
3840×2160 @1 3840×2160 @1 3840×2160 @1
3840×2160 @2 3840×2160 @2 1920×1080 @2

GTK currently does not support xdg_output. To estimate the logical output size for GdkMonitor, it divides the output's size by its scale factor. There might be other legacy clients making the same assumption.

In logical layout mode, mutter currently reports logical geometry for the wl_outputs, but this no longer matches the monitors:

Monitor wl_output GdkMonitor
3840×2160 @1 3840×2160 @1 3840×2160 @1
3840×2160 @2 1920×1080 @2 960×540 @2
3840×2160 @1.5 2560×1440 @2 1280×720 @2

This patch changes logical layout mode to multiply the sizes by the wl_output's scale factor before sending them to the client. Now the sizes match the physical layout mode again:

Monitor wl_output GdkMonitor
3840×2160 @1 3840×2160 @1 3840×2160 @1
3840×2160 @2 3840×2160 @2 1920×1080 @2
3840×2160 @1.5 5120×2880 @2 2560×1440 @2

Unfortunately, non-integer output scales are not representable in wl_output. Still, I believe these values are better than before, and the best we can do for clients that do not know about xdg_output: The size of the output will match the size that a buffer for a fullscreen surface should have at the indicated scale.

Fixes part of https://bugzilla.mozilla.org/show_bug.cgi?id=1534089

Merge request reports