diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2022-08-07 20:14:01 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-09 12:08:21 +0200 |
commit | d11ce1d8080ac2ae6097c63804c7a5fd39cb7713 (patch) | |
tree | 0230713117952f69807eebe07c9557e6f142c300 /Userland | |
parent | 5917545633add7685cff23d44a4d42ae228b6c16 (diff) | |
download | serenity-d11ce1d8080ac2ae6097c63804c7a5fd39cb7713.zip |
WindowServer: Let WindowManager set serverside effects
Menu and Window animations can now be disabled and the geometry
overlay made conditional. Shadow options are dependent on the
current theme actually supplying bitmaps, but they provide a fast
way to toggle those that do without having to edit theme files.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Services/WindowServer/Menu.cpp | 2 | ||||
-rw-r--r-- | Userland/Services/WindowServer/Window.cpp | 4 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowFrame.cpp | 6 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowManager.cpp | 21 |
4 files changed, 26 insertions, 7 deletions
diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 2bf26ff99b..992d114555 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -481,6 +481,8 @@ void Menu::clear_hovered_item() void Menu::start_activation_animation(MenuItem& item) { + if (!WindowManager::the().system_effects().animate_menus()) + return; VERIFY(menu_window()); VERIFY(menu_window()->backing_store()); auto window = Window::construct(*this, WindowType::Menu); diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index aa499fc886..5990f364a3 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -382,6 +382,8 @@ void Window::start_minimize_animation() { if (&window_stack() != &WindowManager::the().current_window_stack()) return; + if (!WindowManager::the().system_effects().animate_windows()) + return; if (!m_have_taskbar_rect) { // If this is a modal window, it may not have its own taskbar // button, so there is no rectangle. In that case, walk the @@ -427,6 +429,8 @@ void Window::start_launch_animation(Gfx::IntRect const& launch_origin_rect) { if (&window_stack() != &WindowManager::the().current_window_stack()) return; + if (!WindowManager::the().system_effects().animate_windows()) + return; m_animation = Animation::create(); m_animation->set_duration(150); diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index 3113d4052c..a3f904d5f4 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -199,8 +199,12 @@ MultiScaleBitmaps const* WindowFrame::shadow_bitmap() const case WindowType::Desktop: return nullptr; case WindowType::Menu: + if (!WindowManager::the().system_effects().menu_shadow()) + return nullptr; return s_menu_shadow; case WindowType::Tooltip: + if (!WindowManager::the().system_effects().tooltip_shadow()) + return nullptr; return s_tooltip_shadow; case WindowType::Taskbar: return s_taskbar_shadow; @@ -209,6 +213,8 @@ MultiScaleBitmaps const* WindowFrame::shadow_bitmap() const case WindowType::WindowSwitcher: return nullptr; default: + if (!WindowManager::the().system_effects().window_shadow()) + return nullptr; // FIXME: Support shadow for themes with border radius if (WindowManager::the().palette().window_border_radius() > 0) return nullptr; diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 1979df2db5..98f04f05d7 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -699,8 +699,10 @@ void WindowManager::start_window_move(Window& window, Gfx::IntPoint const& origi m_move_origin = origin; m_move_window_origin = window.position(); m_move_window_cursor_position = window.is_tiled() ? to_floating_cursor_position(m_mouse_down_origin) : m_mouse_down_origin; - m_geometry_overlay = Compositor::the().create_overlay<WindowGeometryOverlay>(window); - m_geometry_overlay->set_enabled(true); + if (system_effects().geometry() == ShowGeometry::OnMoveAndResize || system_effects().geometry() == ShowGeometry::OnMoveOnly) { + m_geometry_overlay = Compositor::the().create_overlay<WindowGeometryOverlay>(window); + m_geometry_overlay->set_enabled(true); + } window.invalidate(true, true); } @@ -740,8 +742,10 @@ void WindowManager::start_window_resize(Window& window, Gfx::IntPoint const& pos m_resize_window = window; m_resize_origin = position; m_resize_window_original_rect = window.rect(); - m_geometry_overlay = Compositor::the().create_overlay<WindowGeometryOverlay>(window); - m_geometry_overlay->set_enabled(true); + if (system_effects().geometry() == ShowGeometry::OnMoveAndResize || system_effects().geometry() == ShowGeometry::OnResizeOnly) { + m_geometry_overlay = Compositor::the().create_overlay<WindowGeometryOverlay>(window); + m_geometry_overlay->set_enabled(true); + } current_window_stack().set_active_input_tracking_window(nullptr); @@ -843,8 +847,9 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event) m_move_window_origin = m_move_window->position(); } } - - m_geometry_overlay->window_rect_changed(); + if (system_effects().geometry() == ShowGeometry::OnMoveAndResize || system_effects().geometry() == ShowGeometry::OnMoveOnly) { + m_geometry_overlay->window_rect_changed(); + } } return true; } @@ -1017,7 +1022,9 @@ bool WindowManager::process_ongoing_window_resize(MouseEvent const& event) dbgln_if(RESIZE_DEBUG, "[WM] Resizing, original: {}, now: {}", m_resize_window_original_rect, new_rect); m_resize_window->set_rect(new_rect); - m_geometry_overlay->window_rect_changed(); + if (system_effects().geometry() == ShowGeometry::OnMoveAndResize || system_effects().geometry() == ShowGeometry::OnResizeOnly) { + m_geometry_overlay->window_rect_changed(); + } Core::EventLoop::current().post_event(*m_resize_window, make<ResizeEvent>(new_rect)); return true; } |