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

commit2056ac0224bd7c82a18084335f2983999d7245ec
parentae3d70b5c8
authorIsaac Freund <[email protected]>
date2024-12-26 14:57
rwm: add river_node_v1.place_{top,bottom}

 protocol/river-window-management-v1.xml | 20 ++++++++++++++++++++
 river/WmNode.zig                        |  9 +++++++++
 2 files changed, 29 insertions(+)

diff --git a/protocol/river-window-management-v1.xml b/protocol/river-window-management-v1.xml
index ea5a97b..31abbec 100644
--- a/protocol/river-window-management-v1.xml
+++ b/protocol/river-window-management-v1.xml
@@ -825,6 +825,26 @@
       <arg name="y" type="int"/>
     </event>
 
+    <request name="place_top">
+      <description summary="place node above all other nodes">
+        This request places the node above all other nodes in the compositor's
+        render list.
+
+        This request is double-buffered state and will not be applied until the
+        next river_window_manager_v1.commit request.
+      </description>
+    </request>
+
+    <request name="place_bottom">
+      <description summary="place node below all other nodes">
+        This request places the node below all other nodes in the compositor's
+        render list.
+
+        This request is double-buffered state and will not be applied until the
+        next river_window_manager_v1.commit request.
+      </description>
+    </request>
+
     <request name="place_above">
       <description summary="place node above another node">
         This request places the node directly above another node in the
diff --git a/river/WmNode.zig b/river/WmNode.zig
index bbb8016..c8c7f88 100644
--- a/river/WmNode.zig
+++ b/river/WmNode.zig
@@ -21,6 +21,7 @@ const assert = std.debug.assert;
 const wl = @import("wayland").server.wl;
 const river = @import("wayland").server.river;
 
+const server = &@import("main.zig").server;
 const util = @import("util.zig");
 
 const Window = @import("Window.zig");
@@ -109,6 +110,14 @@ fn handleRequest(
                 window.uncommitted.y = args.y;
             },
         },
+        .place_top => {
+            node.link_uncommitted.remove();
+            server.wm.uncommitted.render_list.prepend(node);
+        },
+        .place_bottom => {
+            node.link_uncommitted.remove();
+            server.wm.uncommitted.render_list.append(node);
+        },
         .place_above => |args| {
             const other_data = args.other.getUserData() orelse return;
             const other: *WmNode = @ptrCast(@alignCast(other_data));