Bug 454942 - Provide devicePixelRatio in KDecoration2
Summary: Provide devicePixelRatio in KDecoration2
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: decorations (other bugs)
Version First Reported In: 5.24.90
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-06 19:15 UTC by Paul McAuley
Modified: 2024-12-13 17:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul McAuley 2022-06-06 19:15:22 UTC
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."
Comment 1 Zamundaaa 2024-12-13 17:35:42 UTC
This has been added in KDecoration3