refactor: move XWayland decoration handling into waylib - #1440
Conversation
Reviewer's GuideMoves XWayland property reads and effective decoration policy into waylib, including correct 32-bit XCB property offsets, while reducing Helper to session-atom resolution and applying the resulting decoration flags. Sequence diagram for centralized XWayland decoration resolutionsequenceDiagram
participant Helper
participant SessionManager
participant WXWaylandSurface
participant WXWayland
participant XCB
participant SurfaceWrapper
Helper->>SessionManager: sessionForXWayland(xwayland)
SessionManager-->>Helper: Session
Helper->>WXWaylandSurface: effectiveDecorationsFlags(noTitlebarAtom)
alt bypass manager
WXWaylandSurface-->>Helper: DecorationsNoBorder | DecorationsNoTitle
else managed surface
WXWaylandSurface->>WXWayland: windowProperty(window_id, noTitlebarAtom, XCB_ATOM_CARDINAL)
WXWayland->>XCB: xcb_get_property(..., offset)
XCB-->>WXWayland: property reply
WXWayland-->>WXWaylandSurface: QByteArray
WXWaylandSurface-->>Helper: effective decoration flags
end
Helper->>SurfaceWrapper: setNoTitleBar(flags & DecorationsNoTitle)
Helper->>SurfaceWrapper: setNoDecoration(flags & DecorationsNoBorder)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="waylib/src/server/protocols/wxwaylandsurface.cpp" line_range="548-549" />
<code_context>
+
+ auto flags = decorationsFlags();
+ if (noTitlebarAtom != XCB_ATOM_NONE
+ && !xwayland()->windowProperty(handle()->window_id,
+ noTitlebarAtom,
+ XCB_ATOM_CARDINAL)
+ .isEmpty()) {
</code_context>
<issue_to_address>
**issue (bug_risk):** effectiveDecorationsFlags dereferences xwayland() whenever noTitlebarAtom is non-NONE, so calling it on a WXWaylandSurface constructed with a null WXWayland pointer crashes.
**Triggers:** When a surface is created without an owning WXWayland instance and the caller supplies a no-titlebar atom.
**Suggested fix:** Check that xwayland() is non-null before calling windowProperty, and leave the decoration flags unchanged when it is null.
```suggestion
&& xwayland()
&& !xwayland()->windowProperty(handle()->window_id,
noTitlebarAtom,
```
</issue_to_address>Add WXWayland::windowProperty to centralize XCB window property reads and handle property offsets in the required 32-bit units. Add WXWaylandSurface::effectiveDecorationsFlags to combine the override-redirect state, decoration flags, and the optional no-titlebar property. Simplify Helper to resolve the session atom and apply the effective decoration state. Log: move XWayland decoration handling into waylib PMS: TASK-393779 Influence: Compatible change
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wineee, zzxyb The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
WXWayland::windowProperty uses byte offsets instead of 32-bit units, potentially truncating multi-reply properties.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Refactors XWayland property and decoration handling into waylib, simplifying Helper.
Changes:
- Adds centralized XCB window-property access.
- Adds effective decoration flag resolution.
- Updates
Helperto consume the new decoration state.
| File | Summary |
|---|---|
waylib/src/server/protocols/wxwaylandsurface.h |
Declares effective decoration resolution. |
waylib/src/server/protocols/wxwaylandsurface.cpp |
Computes effective decoration flags. |
waylib/src/server/protocols/wxwayland.h |
Declares centralized property access. |
waylib/src/server/protocols/wxwayland.cpp |
Implements XCB property retrieval. |
src/seat/helper.cpp |
Uses the effective decoration state. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const int length = xcb_get_property_value_length(reply); | ||
| data.append(static_cast<const char *>(xcb_get_property_value(reply)), length); | ||
| remaining = reply->bytes_after; | ||
| offset += length; |

Add WXWayland::windowProperty to centralize XCB window property reads and handle property offsets in the required 32-bit units.
Add WXWaylandSurface::effectiveDecorationsFlags to combine the override-redirect state, decoration flags, and the optional no-titlebar property. Simplify Helper to resolve the session atom and apply the effective decoration state.
Log: move XWayland decoration handling into waylib
PMS: TASK-393779
Influence: Compatible change
Summary by Sourcery
Centralize XWayland window-property and decoration handling in waylib.
Bug Fixes:
Enhancements: