When a decoration gets painted on Wayland, it can query the painter->device()->devicePixelRatioF() to determine the device pixel ratio, which may be needed to properly support HiDPI when things like QImages are used internally within a decoration. This is not the case on X11, where it seems to always return 1.0. Testable with https://invent.kde.org/plasma/breeze/-/merge_requests/67.
Doing some digging, this looks like because the decoration queries the client for the scale which queries the Screens singleton for scale which queries the X11 output, which doesn't set the scale beyond m_backend->initialOutputScale(), which surprise surprise, doesn't change from its default of 1.0 on x11, only on Wayland.
> This is not the case on X11, where it seems to always return 1.0. That's correct. On X11, there is no concept of scale factors.
That doesn't make this not a bug. The rest of KWin's UI would be rendered at a different scale correctly as handled automatically by Qt, but fails to copy Qt's correct behaviour when using custom painting routines for UI elements. The image buffer physical size is already correctly adjusted by the scale factor; it simply doesn't have the correct scale information.
> The image buffer physical size is already correctly adjusted by the scale factor This is because the size of the buffer image is based on the font metrics. Screen scale factors should remain 1, otherwise we may break a lot of things. X11 was not designed with hidpi in mind.
Well, if you're insistent on not doing anything about this bug, I'll work around it in Breeze decorations then ¯\_(ツ)_/¯
But KScreen and Qt have a concept of scale factors on X11. Can't KWin just read from one of them?
No, it's not that simple on X11 unfortunately. You are going to break a lot of things if you do that.