https://bugs.kde.org/show_bug.cgi?id=479703
Bug ID: 479703 Summary: Expose global Wayland screen offsets of top-left of all given KDecoration2 geometries for pixel-snapping with fractional scaling Classification: Plasma Product: kwin Version: master Platform: Other OS: Other Status: REPORTED Severity: wishlist Priority: NOR Component: decorations Assignee: kwin-bugs-n...@kde.org Reporter: k...@paulmcauley.com Target Milestone: --- Hello, I am the developer of a C++ window decoration (https://www.github.com/paulmcauley/klassy). In my window decoration I have attempted to implement a pixel-snapping algorithm so that lines in icons (especially horizontal/vertical lines) and other painted items are sharp - this works on integer scale levels (and by fluke works on scales with a fractional part of 0.5 because I happen to multiply all my geometries by a factor of 2), however, it does not work properly on all fractional scales on Wayland. This is because I am currently assuming that the QPainter device geometry of the top-left of the titlebar is a zero pixel boundary reference point (https://github.com/paulmcauley/klassy/blob/3490b94f721d9cfab4d4cf4691fbfcac8570637d/kdecoration/breezebutton.cpp#L228C2-L228C2) . However, on Wayland this is not always the case with fractional scaling. Therefore, to implement pixel snapping properly with fractional scaling on Wayland, I would kindly request some additions to the KDecoration2 API. Namely, provide functions returning a QPointF that gives the offset position (call it e.g. <geometry>ScreenPos() ) in global Wayland co-ordinates from the current screen position 0,0 to the top-left of a given geometry QRectF. This offset would not be an integer pixel offset, but rather an offset that would need to be floating point for Wayland in the same co-ordinate system used by Wayland, as Wayland co-ordinates are relative to 100% scaling dimensions. This would be a most welcome additional piece of data to complement the following <geometry>s provided with KDecoration2, each with their own added "<geometry>ScreenPos() " offset function: KDecoration2::DecorationButton::geometry() (this one is the most useful as it could be used with standalone buttons as well) KDecoration2::DecorationButtonGroup::geometry() KDecoration2::Decoration::rect() KDecoration2::Decoration::titleBar() (potentially useful in case want to draw on titlebar directly with custom graphics) KDecoration2::DecorationShadow::innerShadowRect() (could potentially be useful for drawing automatic sharper window outlines which are currently done as part of the shadow, though would need this offset available before a shadow is provided by the decoration). Thank you, Paul -- You are receiving this mail because: You are watching all bug changes.