code: Move wlr_output_layout_add from Output.init to Root.addOutput

This commit is contained in:
Marten Ringwelski 2020-11-01 14:49:01 +01:00 committed by Isaac Freund
parent a7459026f6
commit d23b8a7f27
2 changed files with 6 additions and 6 deletions

View file

@ -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;

View file

@ -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) {