Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
Decoration: fix clip x/y coordinates
We need to adjust for the decoration offset since the clip applies
relative to the root of the decoration subsurface tree but is defined
relative to the window.
river/Decoration.zig | 10 +++++++++-
river/Window.zig | 6 +-----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/river/Decoration.zig b/river/Decoration.zig
index f73ad29..4e432ce 100644
--- a/river/Decoration.zig
+++ b/river/Decoration.zig
@@ -137,7 +137,7 @@ fn commit(wlr_surface: *wlr.Surface) callconv(.c) void {
}
}
-pub fn renderFinish(decoration: *Decoration) void {
+pub fn renderFinish(decoration: *Decoration, window_clip: *const wlr.Box) void {
const rendering_requested = &decoration.rendering_requested;
if (rendering_requested.sync_next_commit) {
rendering_requested.sync_next_commit = false;
@@ -154,4 +154,12 @@ pub fn renderFinish(decoration: *Decoration) void {
decoration.surfaces.dropSaved();
decoration.tree.node.setPosition(rendering_requested.offset_x, rendering_requested.offset_y);
+
+ // wlroots asserts that a subsurface tree is present.
+ if (!decoration.surfaces.tree.children.empty()) {
+ var clip = window_clip.*;
+ clip.x -= rendering_requested.offset_x;
+ clip.y -= rendering_requested.offset_y;
+ decoration.surfaces.tree.node.subsurfaceTreeSetClip(&clip);
+ }
}
diff --git a/river/Window.zig b/river/Window.zig
index bd70c98..3cbc177 100644
--- a/river/Window.zig
+++ b/river/Window.zig
@@ -879,11 +879,7 @@ pub fn renderFinish(window: *Window) void {
inline for (.{ &window.decorations_above, &window.decorations_below }) |decorations| {
var it = decorations.iterator(.forward);
while (it.next()) |decoration| {
- decoration.renderFinish();
- // wlroots asserts that a subsurface tree is present.
- if (!decoration.surfaces.tree.children.empty()) {
- decoration.surfaces.tree.node.subsurfaceTreeSetClip(&window.rendering_requested.clip);
- }
+ decoration.renderFinish(&window.rendering_requested.clip);
}
}
}