1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:07:45 +00:00

WindowServer+LibGUI: Yank out window-global opacity

From what I can tell, this facility was added to WSWindow/GWindow in
2019 in 9b71307. I only found a single place in the codebase still using
this facility: `WindowServer::Menu::start_activation_animation()`. A
subtle fade-out animation that happens when a menu item is selected, and
the menu disappears.
I think our compositing facilities have improved enough to make this
facility redundant. The remaining use mentioned above was ported to just
directly blit the fade-out animation instead of requesting it from
WindowServer.
This commit is contained in:
Valtteri Koskivuori 2023-06-21 23:16:26 +03:00 committed by Jelle Raaijmakers
parent 4fd71e3c3a
commit 6931a5a0a8
9 changed files with 18 additions and 70 deletions

View file

@ -393,10 +393,7 @@ void Compositor::compose()
return;
auto clear_window_rect = [&](const Gfx::IntRect& clear_rect) {
auto fill_color = wm.palette().window();
if (!window.is_opaque())
fill_color.set_alpha(255 * window.opacity());
painter.fill_rect(clear_rect, fill_color);
painter.fill_rect(clear_rect, wm.palette().window());
};
if (!backing_store) {
@ -447,20 +444,11 @@ void Compositor::compose()
auto dst = backing_rect.location().translated(dirty_rect_in_backing_coordinates.location());
if (window.client() && window.client()->is_unresponsive()) {
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;
});
}
painter.blit_filtered(dst, *backing_store, dirty_rect_in_backing_coordinates, [](Color src) {
return src.to_grayscale().darkened(0.75f);
});
} else {
painter.blit(dst, *backing_store, dirty_rect_in_backing_coordinates, window.opacity());
painter.blit(dst, *backing_store, dirty_rect_in_backing_coordinates);
}
}