From b5597f5b4471a96254e21bbd1956b248afdd4a48 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 27 Dec 2019 12:53:58 +0100 Subject: output: clear pending bit if pending == current In case the pending value is the same as the current value, clear the bit from pending.committed. --- types/wlr_output.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index 8aca64d9..935e1719 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -156,6 +156,7 @@ static void output_update_matrix(struct wlr_output *output) { void wlr_output_enable(struct wlr_output *output, bool enable) { if (output->enabled == enable) { + output->pending.committed &= ~WLR_OUTPUT_STATE_ENABLED; return; } @@ -175,11 +176,12 @@ static void output_state_clear_mode(struct wlr_output_state *state) { void wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode) { + output_state_clear_mode(&output->pending); + if (output->current_mode == mode) { return; } - output_state_clear_mode(&output->pending); output->pending.committed |= WLR_OUTPUT_STATE_MODE; output->pending.mode_type = WLR_OUTPUT_STATE_MODE_FIXED; output->pending.mode = mode; @@ -187,12 +189,13 @@ void wlr_output_set_mode(struct wlr_output *output, void wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, int32_t height, int32_t refresh) { + output_state_clear_mode(&output->pending); + if (output->width == width && output->height == height && output->refresh == refresh) { return; } - output_state_clear_mode(&output->pending); output->pending.committed |= WLR_OUTPUT_STATE_MODE; output->pending.mode_type = WLR_OUTPUT_STATE_MODE_CUSTOM; output->pending.custom_mode.width = width; @@ -236,6 +239,7 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width, void wlr_output_set_transform(struct wlr_output *output, enum wl_output_transform transform) { if (output->transform == transform) { + output->pending.committed &= ~WLR_OUTPUT_STATE_TRANSFORM; return; } @@ -245,6 +249,7 @@ void wlr_output_set_transform(struct wlr_output *output, void wlr_output_set_scale(struct wlr_output *output, float scale) { if (output->scale == scale) { + output->pending.committed &= ~WLR_OUTPUT_STATE_SCALE; return; } -- cgit v1.2.3