From e81e27438086be1f3c494cc93057c26f2699d968 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Wed, 3 Jul 2024 13:32:19 +0300 Subject: [PATCH] output: don't redraw if there's nothing to animate --- src/output.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/output.c b/src/output.c index eb57bbd..224f801 100644 --- a/src/output.c +++ b/src/output.c @@ -371,15 +371,22 @@ static void redraw(struct dp_output *output) { } cairo_stroke(buffer->cairo); + + if (config->border_gradient != DP_BORDER_GRADIENT_NONE && + config->animation_duration != 0) { + bool whole = selection->x == 0 && selection->y == 0 && + selection->width == output->effective_width && + selection->height == output->effective_height; + if (!whole) { + // The border is animated and visible + output->needs_redraw = true; + } + } } cairo_rectangle(buffer->cairo, x, y, width, height); set_cairo_color(buffer->cairo, config->selected_color); cairo_fill(buffer->cairo); - - if (config->border_gradient != DP_BORDER_GRADIENT_NONE && config->animation_duration != 0) { - output->needs_redraw = true; - } } wl_surface_attach(output->select_surface, buffer->wl_buffer, 0, 0);