output-management: fix output config application

Currently wlr-output-management config application is broken since the
pre 0.17 code relied on the (now removed) output enable/disable event to
be emitted as part of the state application.

The old code was pretty smelly and hard to understand, I'm glad the
upstream improvements pushed river's code in this directions.
This commit is contained in:
Isaac Freund
2023-12-29 17:15:51 -06:00
parent b440767b54
commit 5f0c9e2ccf
2 changed files with 38 additions and 36 deletions

View File

@ -419,22 +419,36 @@ fn handleDestroy(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void {
fn handleRequestState(listener: *wl.Listener(*wlr.Output.event.RequestState), event: *wlr.Output.event.RequestState) void {
const output = @fieldParentPtr(Self, "request_state", listener);
// TODO double buffer output state changes for frame perfection and cleaner code.
// Schedule a frame and commit in the frame handler.
if (!output.wlr_output.commitState(event.state)) {
output.applyState(event.state) catch {
log.err("failed to commit requested state", .{});
return;
};
server.root.applyPending();
}
// TODO double buffer output state changes for frame perfection and cleaner code.
// Schedule a frame and commit in the frame handler.
// Get rid of this function.
pub fn applyState(output: *Self, state: *wlr.Output.State) error{CommitFailed}!void {
// We need to be precise about this state change to make assertions
// in handleEnableDisable() possible.
const enable_state_change = state.committed.enabled and
(state.enabled != output.wlr_output.enabled);
if (!output.wlr_output.commitState(state)) {
return error.CommitFailed;
}
if (event.state.committed.enabled) {
if (enable_state_change) {
output.handleEnableDisable();
}
if (event.state.committed.mode) {
if (state.committed.mode) {
output.updateBackgroundRect();
output.arrangeLayers();
server.lock_manager.updateLockSurfaceSize(output);
server.root.applyPending();
}
}
@ -462,6 +476,8 @@ fn handleEnableDisable(output: *Self) void {
output.lock_render_state = .blanked;
output.normal_content.node.setEnabled(false);
output.locked_content.node.setEnabled(true);
server.root.deactivateOutput(output);
}
}