Add tearing support (#1390)

Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
This commit is contained in:
Ph42oN 2024-01-08 22:58:58 +02:00 committed by GitHub
parent 72f3ce6b41
commit bce0c6ce56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 111 additions and 1 deletions

View file

@ -27,6 +27,25 @@
#include "view.h"
#include "xwayland.h"
static bool
get_tearing_preference(struct output *output)
{
struct server *server = output->server;
/* Never allow tearing when disabled */
if (!rc.allow_tearing) {
return false;
}
/* Tearing is only allowed for the output with the active view */
if (!server->active_view || server->active_view->output != output) {
return false;
}
/* If the active view requests tearing, or it is toggled on with action, allow it */
return server->active_view->tearing_hint;
}
static void
output_frame_notify(struct wl_listener *listener, void *data)
{
@ -68,7 +87,9 @@ output_frame_notify(struct wl_listener *listener, void *data)
return;
}
wlr_scene_output_commit(output->scene_output, NULL);
output->wlr_output->pending.tearing_page_flip =
get_tearing_preference(output);
lab_wlr_scene_output_commit(output->scene_output);
struct timespec now = { 0 };
clock_gettime(CLOCK_MONOTONIC, &now);