From 4dc5a04735738d3c8d600cee98ab5702a605bfd6 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 4 Aug 2019 23:15:10 +0100 Subject: [PATCH] core: fix background not blurred under transparent windows When a window has 0 opacity, it's rendering is skipped completely. Thus its background isn't blurred. This commit fixes that. Signed-off-by: Yuxuan Shui --- src/backend/backend.c | 5 ++++- src/compton.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/backend.c b/src/backend/backend.c index 7295ecfc..7525d7f3 100644 --- a/src/backend/backend.c +++ b/src/backend/backend.c @@ -252,7 +252,10 @@ void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) { ps->backend_data->ops->compose(ps->backend_data, w->win_image, w->g.x, w->g.y, ®_paint_in_bound, ®_visible); - } else { + } else if (w->opacity * MAX_ALPHA >= 1){ + // We don't need to paint the window body itself if it's + // completely transparent. + // For window image processing, we don't need to limit the process // region to damage, since the window image data is independent // from the target image data, which we want to protect. diff --git a/src/compton.c b/src/compton.c index 730a6c9e..92797a9f 100644 --- a/src/compton.c +++ b/src/compton.c @@ -511,7 +511,8 @@ static struct managed_win *paint_preprocess(session_t *ps, bool *fade_running) { if (!w->ever_damaged || w->g.x + w->g.width < 1 || w->g.y + w->g.height < 1 || w->g.x >= ps->root_width || w->g.y >= ps->root_height || w->state == WSTATE_UNMAPPED || - (double)w->opacity * MAX_ALPHA < 1 || w->paint_excluded) { + ((double)w->opacity * MAX_ALPHA < 1 && !w->blur_background) || + w->paint_excluded) { // TODO: for consistency, even a window has 0 opacity, we still // probably need to blur its background, so to_paint shouldn't be // false for them.