Skip to content

Display (Linux): fixes scale factor of rotated outputs on Wayland - #2745

Merged
CarterLi merged 1 commit into
fastfetch-cli:devfrom
pkubaj:fix-rotated-scaling
Nov 23, 2026
Merged

CarterLi merged 1 commit into
fastfetch-cli:devfrom
pkubaj:fix-rotated-scaling

Conversation

@pkubaj

@pkubaj pkubaj commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Summary

On Wayland, a monitor rotated by 90 or 270 degrees gets a wrong scale factor. For example, a 1920x1200 monitor in portrait mode at scale 1 is shown as:

Display (DELL U2415): 1200x1920 @ 1.59x in 24", 60 Hz [External]

handleXdgLogicalSize() computes the scale from the wl_output mode width and the zxdg_output_v1 logical width. The logical size is already transformed, but the mode is swapped only later, in ffWaylandHandleRotation(). So a rotated output compares its width with its logical height: 1920 * 96 / 1200 = 153 dpi, shown as @ 1.59x.

This PR compares the logical width with the mode height for the 90 / 270 degree transforms (transform & WL_OUTPUT_TRANSFORM_90). The wl_output events, including the transform from geometry, are all received before get_xdg_output is requested, so the transform is known in that handler.

Related issue (required for new logos for new distros)

None. I didn't find an existing issue.

Changes

  • src/detection/displayserver/linux/wayland/global-output.c: use the mode height instead of the width when the output is rotated by 90 / 270 degrees.
  • CHANGELOG.md: Bugfixes entry.

Screenshots

Text output only (fastfetch --logo none -s display). I tested on dwl 0.9 / wlroots 0.20 with headless outputs at several transforms and scales.

Output Before After
1920x1080, transform 270, scale 1 1080x1920 @ 1.77x 1080x1920
1920x1080, transform 270, scale 2 1080x1920 @ 3.55x 1080x1920 @ 2x
3840x2160, transform 90, scale 1.5 2160x3840 @ 2.67x 2160x3840 @ 1.5x
3840x2160, normal, scale 2 3840x2160 @ 2x 3840x2160 @ 2x

I found the bug on a real 1920x1200 monitor in portrait mode next to a 4K monitor at scale 2, where it showed @ 1.59x as above.

Checklist

  • I have tested my changes locally.

The scale factor is computed from the wl_output mode width and the
zxdg_output_v1 logical width. The logical size is already transformed,
but the mode is only swapped later in ffWaylandHandleRotation(), so a
monitor rotated by 90 or 270 degrees compared its width with its
logical height. A 1920x1200 monitor in portrait at scale 1 was reported
as 1920 * 96 / 1200 = 153 dpi, shown as `@ 1.59x`.

Compare with the mode height for 90 / 270 degree transforms instead.
@CarterLi

Copy link
Copy Markdown
Member

Thanks. Will cut a release this week.

@CarterLi
CarterLi merged commit 492bef5 into fastfetch-cli:dev Nov 23, 2026
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants