tearing-control: minor cleanups/style improvements

This commit also tweaks the riverctl interface to make the global
allow-tearing option apply only to tearing-control-v1 hints from
clients. The global option no longer affects tearing/no-tearing rules
explicitly created by the user.

(cherry picked from commit f82b2f5816)
This commit is contained in:
Isaac Freund
2024-08-15 11:42:38 +02:00
parent aa1ef64448
commit c691396448
6 changed files with 37 additions and 40 deletions

View File

@ -557,18 +557,21 @@ fn renderAndCommit(output: *Output, scene_output: *wlr.SceneOutput) !void {
}
}
if (output.allowTearing() and server.config.allow_tearing == .enabled) {
state.tearing_page_flip = true;
if (!output.wlr_output.testState(&state)) {
log.debug("tearing page flip test failed for {s}, retrying without tearing", .{output.wlr_output.name});
state.tearing_page_flip = false;
if (output.current.fullscreen) |fullscreen| {
if (fullscreen.allowTearing()) {
state.tearing_page_flip = true;
if (!output.wlr_output.testState(&state)) {
log.debug("tearing page flip test failed for {s}, retrying without tearing", .{
output.wlr_output.name,
});
state.tearing_page_flip = false;
}
}
}
if (!output.wlr_output.commitState(&state)) return error.CommitFailed;
if (output.gamma_dirty) output.gamma_dirty = false;
output.gamma_dirty = false;
if (server.lock_manager.state == .locked or
(server.lock_manager.state == .waiting_for_lock_surfaces and output.locked_content.node.enabled) or
@ -642,14 +645,6 @@ fn setTitle(output: Output) void {
}
}
fn allowTearing(output: *Output) bool {
if (output.current.fullscreen) |fullscreen_view| {
return fullscreen_view.allowTearing();
}
return false;
}
pub fn handleLayoutNamespaceChange(output: *Output) void {
// The user changed the layout namespace of this output. Try to find a
// matching layout.