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, .height = 0,
}; };
} else { } 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 // Ensure that a cursor image at the output's scale factor is loaded
// for each seat. // for each seat.
var it = root.server.input_manager.seats.first; 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); 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 // if we previously had no real outputs, move focus from the noop output
// to the new one. // to the new one.
if (self.outputs.len == 1) { if (self.outputs.len == 1) {