From c3f5b514c85d1e96c2a7d3bc8c75073bbcf9afdc Mon Sep 17 00:00:00 2001 From: Valtteri Koskivuori Date: Wed, 21 Jun 2023 23:35:49 +0300 Subject: [PATCH] WindowServer: Yank out window frame opacity This facility was added in 15a1d9a, but isn't being used for anything. It wasn't even hooked up to LibGUI for applications to use. Relevant use-cases, such as the most prominent one in `AnalogClock`, use `GUI::Window::set_frameless()` instead. --- .../Services/WindowServer/WindowFrame.cpp | 20 ++++--------------- Userland/Services/WindowServer/WindowFrame.h | 10 +--------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index 99fa13ab69..0c43511bf0 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -358,14 +358,14 @@ void WindowFrame::PerScaleRenderedCache::paint(WindowFrame& frame, Gfx::Painter& // We have a top piece auto src_rect = rect.intersected(Gfx::Rect { frame_rect.location(), { frame_rect.width(), m_bottom_y } }); if (!src_rect.is_empty()) - painter.blit(src_rect.location(), *m_top_bottom, src_rect.translated(-frame_rect.location()), frame.opacity()); + painter.blit(src_rect.location(), *m_top_bottom, src_rect.translated(-frame_rect.location())); } if (m_bottom_y < top_bottom_height) { // We have a bottom piece Gfx::IntRect rect_in_frame { frame_rect.x(), window_rect.bottom(), frame_rect.width(), top_bottom_height - m_bottom_y }; auto src_rect = rect.intersected(rect_in_frame); if (!src_rect.is_empty()) - painter.blit(src_rect.location(), *m_top_bottom, src_rect.translated(-rect_in_frame.x(), -rect_in_frame.y() + m_bottom_y), frame.opacity()); + painter.blit(src_rect.location(), *m_top_bottom, src_rect.translated(-rect_in_frame.x(), -rect_in_frame.y() + m_bottom_y)); } } @@ -376,14 +376,14 @@ void WindowFrame::PerScaleRenderedCache::paint(WindowFrame& frame, Gfx::Painter& Gfx::IntRect rect_in_frame { frame_rect.x(), window_rect.y(), m_right_x, window_rect.height() }; auto src_rect = rect.intersected(rect_in_frame); if (!src_rect.is_empty()) - painter.blit(src_rect.location(), *m_left_right, src_rect.translated(-rect_in_frame.location()), frame.opacity()); + painter.blit(src_rect.location(), *m_left_right, src_rect.translated(-rect_in_frame.location())); } if (m_right_x < left_right_width) { // We have a right piece Gfx::IntRect rect_in_frame { window_rect.right(), window_rect.y(), left_right_width - m_right_x, window_rect.height() }; auto src_rect = rect.intersected(rect_in_frame); if (!src_rect.is_empty()) - painter.blit(src_rect.location(), *m_left_right, src_rect.translated(-rect_in_frame.x() + m_right_x, -rect_in_frame.y()), frame.opacity()); + painter.blit(src_rect.location(), *m_left_right, src_rect.translated(-rect_in_frame.x() + m_right_x, -rect_in_frame.y())); } } } @@ -549,18 +549,6 @@ void WindowFrame::PerScaleRenderedCache::render(WindowFrame& frame, Screen& scre m_shadow_dirty = false; } -void WindowFrame::set_opacity(float opacity) -{ - if (m_opacity == opacity) - return; - bool was_opaque = is_opaque(); - m_opacity = opacity; - if (was_opaque != is_opaque()) - Compositor::the().invalidate_occlusions(); - Compositor::the().invalidate_screen(render_rect()); - WindowManager::the().notify_opacity_changed(m_window); -} - Gfx::IntRect WindowFrame::inflated_for_shadow(Gfx::IntRect const& frame_rect) const { if (auto* shadow = shadow_bitmap()) { diff --git a/Userland/Services/WindowServer/WindowFrame.h b/Userland/Services/WindowServer/WindowFrame.h index b5845c784b..f71800a029 100644 --- a/Userland/Services/WindowServer/WindowFrame.h +++ b/Userland/Services/WindowServer/WindowFrame.h @@ -94,16 +94,9 @@ public: void set_has_alpha_channel(bool value) { m_has_alpha_channel = value; } bool has_shadow() const; - void set_opacity(float); - float opacity() const { return m_opacity; } - bool is_opaque() const { - if (opacity() < 1.0f) - return false; - if (has_alpha_channel()) - return false; - return true; + return !has_alpha_channel(); } void set_dirty(bool re_render_shadow = false) @@ -148,7 +141,6 @@ private: RefPtr m_flash_timer; size_t m_flash_counter { 0 }; - float m_opacity { 1 }; bool m_has_alpha_channel { false }; };