From e1333724ea7d8f2dd8669ddae6554b925e170281 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 10 Feb 2021 23:30:55 -0700 Subject: WindowServer: Blit backing bitmap with transparency for hung windows We should respect the opacity of the window when painting the window content of a hung application. --- Userland/Services/WindowServer/Compositor.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp index 7de34140b6..84bb651e5b 100644 --- a/Userland/Services/WindowServer/Compositor.cpp +++ b/Userland/Services/WindowServer/Compositor.cpp @@ -345,9 +345,18 @@ void Compositor::compose() auto dst = backing_rect.location().translated(dirty_rect_in_backing_coordinates.location()); if (window.client() && window.client()->is_unresponsive()) { - painter.blit_filtered(dst, *backing_store, dirty_rect_in_backing_coordinates, [](Color src) { - return src.to_grayscale().darkened(0.75f); - }); + if (window.is_opaque()) { + painter.blit_filtered(dst, *backing_store, dirty_rect_in_backing_coordinates, [](Color src) { + return src.to_grayscale().darkened(0.75f); + }); + } else { + u8 alpha = 255 * window.opacity(); + painter.blit_filtered(dst, *backing_store, dirty_rect_in_backing_coordinates, [&](Color src) { + auto color = src.to_grayscale().darkened(0.75f); + color.set_alpha(alpha); + return color; + }); + } } else { painter.blit(dst, *backing_store, dirty_rect_in_backing_coordinates, window.opacity()); } -- cgit v1.2.3