This is a feature request for an additional parameter in the KDecoration2 API. Currently, in KDecoration you can only access devicePixelRatioF() (of the current screen which the window exists) within the Decoration::paint method via painter->device()->devicePixelRatioF(). However, in my own C++ window decoration I also paint some elements outside the Decoration::paint method (for example, a window outline in the shadow, and a separator under the titlebar). For these I would like access to devicePixelRatioF() for more precise painting (e.g. with a cosmetic brush) and alignment under Wayland. Vlad Zahorodnii also mentioned this as a possibility in an old merge request at https://invent.kde.org/plasma/breeze/-/merge_requests/75 : "Vlad Zahorodnii @vladz ยท 1 year ago Developer KWin is the true source of device pixel ratio information. If such information is needed, it can be added in KDecoration2 library, e.g. a devicePixelRatio getter and a signal."
This has been added in KDecoration3