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

commit2f286d9e6990bb9fca55d64dcaac4f172e58c423
parent367378bef4
authorMarten Ringwelski <[email protected]>
date2020-11-01 14:49
code: Move wlr_output_layout_add from Output.init to Root.addOutput

 river/Output.zig | 6 ------
 river/Root.zig   | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/river/Output.zig b/river/Output.zig
index 248d0fe..6d01ce4 100644
--- a/river/Output.zig
+++ b/river/Output.zig
@@ -121,12 +121,6 @@ pub fn init(self: *Self, root: *Root, wlr_output: *c.wlr_output) !void {
             .height = 0,
         };
     } else {
-        // Add the new output to the layout. The add_auto function arranges outputs
-        // from left-to-right in the order they appear. A more sophisticated
-        // compositor would let the user configure the arrangement of outputs in the
-        // layout. This automatically creates an output global on the wl_display.
-        c.wlr_output_layout_add_auto(root.wlr_output_layout, wlr_output);
-
         // Ensure that a cursor image at the output's scale factor is loaded
         // for each seat.
         var it = root.server.input_manager.seats.first;
diff --git a/river/Root.zig b/river/Root.zig
index 4b34024..38fd24f 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -102,6 +102,12 @@ pub fn addOutput(self: *Self, wlr_output: *c.wlr_output) void {
     };
     self.outputs.append(node);
 
+    // Add the new output to the layout. The add_auto function arranges outputs
+    // from left-to-right in the order they appear. A more sophisticated
+    // compositor would let the user configure the arrangement of outputs in the
+    // layout. This automatically creates an output global on the wl_display.
+    c.wlr_output_layout_add_auto(self.wlr_output_layout, wlr_output);
+
     // if we previously had no real outputs, move focus from the noop output
     // to the new one.
     if (self.outputs.len == 1) {