git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commita39da90a9fa8d0253c991018ff13dff499ed6924
parent20994db1dc
authorIsaac Freund <[email protected]>
date2021-01-07 16:09
render: iterate subsurfaces of popups manually

wlr_xdg_surface_for_each_popup() fails to do this and
wlr_xdg_surface_for_each_popup_surface() is not yet merged, so implement
a workaround for now.

 river/render.zig | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/river/render.zig b/river/render.zig
index 5c04182..e2b2097 100644
--- a/river/render.zig
+++ b/river/render.zig
@@ -226,7 +226,24 @@ fn renderViewPopups(output: *const Output, view: *View, now: *os.timespec) void
         .when = now,
         .opacity = view.opacity,
     };
-    view.forEachPopup(*SurfaceRenderData, renderSurfaceIterator, &rdata);
+    view.forEachPopup(*SurfaceRenderData, renderPopupSurfaceIterator, &rdata);
+}
+
+// TODO(wlroots): replace with wlr_xdg_surface_for_each_popup_surface()
+fn renderPopupSurfaceIterator(
+    surface: *wlr.Surface,
+    surface_x: c_int,
+    surface_y: c_int,
+    rdata: *SurfaceRenderData,
+) callconv(.C) void {
+    var new_rdata = SurfaceRenderData{
+        .output = rdata.output,
+        .output_x = rdata.output_x + surface_x,
+        .output_y = rdata.output_y + surface_y,
+        .when = rdata.when,
+        .opacity = rdata.opacity,
+    };
+    surface.forEachSurface(*SurfaceRenderData, renderSurfaceIterator, &new_rdata);
 }
 
 fn renderDragIcons(output: *const Output, now: *os.timespec) void {