Add support for tearing-control-v1

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3871

Adds option to allow tearing per output, as well as an option to force
enable or disable tearing for a specific application using a window
rule. Only works with fullscreen applications.
This commit is contained in:
Ricardo Steijn 2024-08-05 02:13:49 +02:00 committed by GitHub
parent b881c2e84c
commit 9a1c411abd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 243 additions and 3 deletions

View file

@ -58,6 +58,7 @@ bool view_init(struct sway_view *view, enum sway_view_type type,
view->executed_criteria = create_list();
view->allow_request_urgent = true;
view->shortcuts_inhibit = SHORTCUTS_INHIBIT_DEFAULT;
view->tearing_mode = TEARING_WINDOW_HINT;
wl_signal_init(&view->events.unmap);
return true;
}
@ -1260,6 +1261,19 @@ bool view_is_transient_for(struct sway_view *child,
child->impl->is_transient_for(child, ancestor);
}
bool view_can_tear(struct sway_view *view) {
switch (view->tearing_mode) {
case TEARING_OVERRIDE_FALSE:
return false;
case TEARING_OVERRIDE_TRUE:
return true;
case TEARING_WINDOW_HINT:
return view->tearing_hint ==
WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC;
}
return false;
}
static void send_frame_done_iterator(struct wlr_scene_buffer *scene_buffer,
int x, int y, void *data) {
struct timespec *when = data;