Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
Output: reinitialize output_status, cleanup
If a output is removed and added back without being destroyed this must
be reinitialized.
This commit also cleans up the Root.applyPending() calls related to
output hotplug and adds some more logging.
river/Output.zig | 10 ++++++----
river/Root.zig | 10 +++++++---
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/river/Output.zig b/river/Output.zig
index 15c2be4..b28fb66 100644
--- a/river/Output.zig
+++ b/river/Output.zig
@@ -381,15 +381,13 @@ fn handleDestroy(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void {
const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", output);
util.gpa.destroy(node);
+
+ server.root.applyPending();
}
fn handleEnable(listener: *wl.Listener(*wlr.Output), wlr_output: *wlr.Output) void {
const self = @fieldParentPtr(Self, "enable", listener);
- // Add the output to root.outputs and the output layout if it has not
- // already been added.
- if (wlr_output.enabled) server.root.addOutput(self);
-
// We can't assert the current state of normal_content/locked_content
// here as this output may be newly created.
if (wlr_output.enabled) {
@@ -409,6 +407,10 @@ fn handleEnable(listener: *wl.Listener(*wlr.Output), wlr_output: *wlr.Output) vo
// Disabling and re-enabling an output always blanks it.
self.lock_render_state = .blanked;
}
+
+ // Add the output to root.outputs and the output layout if it has not
+ // already been added.
+ if (wlr_output.enabled) server.root.addOutput(self);
}
fn handleMode(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void {
diff --git a/river/Root.zig b/river/Root.zig
index 3c8a4b3..fb5379c 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -295,8 +295,7 @@ pub fn removeOutput(root: *Self, output: *Output) void {
}
output.status.deinit();
-
- root.applyPending();
+ output.status.init();
}
/// Add the output to self.outputs and the output layout if it has not
@@ -338,8 +337,9 @@ pub fn addOutput(root: *Self, output: *Output) void {
seat.focusOutput(output);
}
}
- root.applyPending();
}
+
+ root.applyPending();
}
/// Trigger asynchronous application of pending state for all outputs and views.
@@ -546,6 +546,8 @@ fn commitTransaction(root: *Self) void {
assert(root.inflight_layout_demands == 0);
assert(root.inflight_configures == 0);
+ std.log.scoped(.transaction).debug("commiting transaction", .{});
+
{
var it = root.hidden.inflight.focus_stack.safeIterator(.forward);
while (it.next()) |view| {
@@ -656,6 +658,8 @@ fn handleManagerApply(
const self = @fieldParentPtr(Self, "manager_apply", listener);
defer config.destroy();
+ std.log.scoped(.output_manager).info("applying output configuration", .{});
+
self.processOutputConfig(config, .apply);
// Send the config that was actually applied