diff --git a/include/sway/output.h b/include/sway/output.h index 3bb5c9c63..8ded00f43 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -73,8 +73,7 @@ struct sway_output { int max_render_time; // In milliseconds struct wl_event_source *repaint_timer; bool gamma_lut_changed; - bool allow_tearing; - bool tearing_state, tearing_state_changed; + bool allow_tearing, can_tear; }; struct sway_output_non_desktop { diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 3e2d8c9f5..58aa79080 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -299,9 +299,8 @@ static int output_repaint_timer_handler(void *data) { } } - if (output->tearing_state_changed) { - output->tearing_state_changed = false; - pending.tearing_page_flip = output->tearing_state; + if (output->can_tear) { + pending.tearing_page_flip = true; if (!wlr_output_test_state(output->wlr_output, &pending)) { output->allow_tearing = false; @@ -383,15 +382,11 @@ static void handle_frame(struct wl_listener *listener, void *user_data) { int delay = msec_until_refresh - output->max_render_time; struct sway_view *fullscreen_view = output_get_fullscreen_view(output); - bool can_tear = output_can_tear_fullscreen_view(output, fullscreen_view); - if (can_tear != output->tearing_state) { - output->tearing_state_changed = true; - } - output->tearing_state = can_tear; + output->can_tear = output_can_tear_fullscreen_view(output, fullscreen_view); // If the delay is less than 1 millisecond (which is the least we can wait) // or if the output is allowed to tear, then just render right away. - if (delay < 1 || can_tear) { + if (delay < 1 || output->can_tear) { output_repaint_timer_handler(output); } else { output->wlr_output->frame_pending = true;