diff --git a/Base/res/icons/themes/Default/window-shadow.png b/Base/res/icons/themes/Default/frame-shadow-dark.png similarity index 100% rename from Base/res/icons/themes/Default/window-shadow.png rename to Base/res/icons/themes/Default/frame-shadow-dark.png diff --git a/Base/res/icons/themes/Default/frame-shadow-light.png b/Base/res/icons/themes/Default/frame-shadow-light.png new file mode 100644 index 0000000000..29da33354d Binary files /dev/null and b/Base/res/icons/themes/Default/frame-shadow-light.png differ diff --git a/Base/res/themes/Default.ini b/Base/res/themes/Default.ini index fbf30e044f..b35e4fa134 100644 --- a/Base/res/themes/Default.ini +++ b/Base/res/themes/Default.ini @@ -73,6 +73,9 @@ TitleButtonWidth=15 TitleButtonHeight=15 [Paths] -MenuShadow=/res/icons/themes/Default/window-shadow.png -TooltipShadow=/res/icons/themes/Default/window-shadow.png -WindowShadow=/res/icons/themes/Default/window-shadow.png +ActiveWindowShadow=/res/icons/themes/Default/frame-shadow-dark.png +InactiveWindowShadow=/res/icons/themes/Default/frame-shadow-light.png +MenuBarShadow=/res/icons/themes/Default/frame-shadow-light.png +MenuShadow=/res/icons/themes/Default/frame-shadow-light.png +TaskBarShadow=/res/icons/themes/Default/frame-shadow-light.png +TooltipShadow=/res/icons/themes/Default/frame-shadow-light.png diff --git a/Userland/Libraries/LibGfx/Palette.h b/Userland/Libraries/LibGfx/Palette.h index b775be85cf..34ce928ba8 100644 --- a/Userland/Libraries/LibGfx/Palette.h +++ b/Userland/Libraries/LibGfx/Palette.h @@ -140,8 +140,11 @@ public: int window_title_button_height() const { return metric(MetricRole::TitleButtonHeight); } String title_button_icons_path() const { return path(PathRole::TitleButtonIcons); } - String window_shadow_path() const { return path(PathRole::WindowShadow); } + String active_window_shadow_path() const { return path(PathRole::ActiveWindowShadow); } + String inactive_window_shadow_path() const { return path(PathRole::InactiveWindowShadow); } + String menu_bar_shadow_path() const { return path(PathRole::MenuBarShadow); } String menu_shadow_path() const { return path(PathRole::MenuShadow); } + String task_bar_shadow_path() const { return path(PathRole::TaskBarShadow); } String tooltip_shadow_path() const { return path(PathRole::TooltipShadow); } Color color(ColorRole role) const { return m_impl->color(role); } diff --git a/Userland/Libraries/LibGfx/SystemTheme.cpp b/Userland/Libraries/LibGfx/SystemTheme.cpp index 51c31da807..6e2961a3f7 100644 --- a/Userland/Libraries/LibGfx/SystemTheme.cpp +++ b/Userland/Libraries/LibGfx/SystemTheme.cpp @@ -119,9 +119,12 @@ Core::AnonymousBuffer load_system_theme(const String& path) } while (0) DO_PATH(TitleButtonIcons, false); + DO_PATH(ActiveWindowShadow, true); + DO_PATH(InactiveWindowShadow, true); + DO_PATH(TaskBarShadow, true); + DO_PATH(MenuBarShadow, true); DO_PATH(MenuShadow, true); DO_PATH(TooltipShadow, true); - DO_PATH(WindowShadow, true); return buffer; } diff --git a/Userland/Libraries/LibGfx/SystemTheme.h b/Userland/Libraries/LibGfx/SystemTheme.h index a34872c7a6..ad7c423b92 100644 --- a/Userland/Libraries/LibGfx/SystemTheme.h +++ b/Userland/Libraries/LibGfx/SystemTheme.h @@ -144,7 +144,10 @@ enum class MetricRole { enum class PathRole { NoRole, TitleButtonIcons, - WindowShadow, + InactiveWindowShadow, + ActiveWindowShadow, + TaskBarShadow, + MenuBarShadow, MenuShadow, TooltipShadow, __Count, diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index 385a9851da..0a28629e16 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -474,7 +474,7 @@ void Window::invalidate(bool invalidate_frame, bool re_render_frame) m_invalidated_frame = true; } if (re_render_frame) - frame().set_dirty(); + frame().set_dirty(true); m_dirty_rects.clear(); Compositor::the().invalidate_window(); } diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index ac8644de01..9c17e967d9 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -60,11 +60,17 @@ static Gfx::Bitmap* s_close_icon; static String s_last_title_button_icons_path; static int s_last_title_button_icons_scale; -static Gfx::Bitmap* s_window_shadow; +static Gfx::Bitmap* s_active_window_shadow; +static Gfx::Bitmap* s_inactive_window_shadow; +static Gfx::Bitmap* s_menu_bar_shadow; static Gfx::Bitmap* s_menu_shadow; +static Gfx::Bitmap* s_task_bar_shadow; static Gfx::Bitmap* s_tooltip_shadow; -static String s_last_window_shadow_path; +static String s_last_active_window_shadow_path; +static String s_last_inactive_window_shadow_path; +static String s_last_menu_bar_shadow_path; static String s_last_menu_shadow_path; +static String s_last_task_bar_shadow_path; static String s_last_tooltip_shadow_path; static Gfx::IntRect frame_rect_for_window(Window& window, const Gfx::IntRect& rect) @@ -185,8 +191,11 @@ void WindowFrame::reload_config() last_path = String::empty(); } }; - load_shadow(WindowManager::the().palette().window_shadow_path(), s_last_window_shadow_path, s_window_shadow); + load_shadow(WindowManager::the().palette().active_window_shadow_path(), s_last_active_window_shadow_path, s_active_window_shadow); + load_shadow(WindowManager::the().palette().inactive_window_shadow_path(), s_last_inactive_window_shadow_path, s_inactive_window_shadow); + load_shadow(WindowManager::the().palette().menu_bar_shadow_path(), s_last_menu_bar_shadow_path, s_menu_bar_shadow); load_shadow(WindowManager::the().palette().menu_shadow_path(), s_last_menu_shadow_path, s_menu_shadow); + load_shadow(WindowManager::the().palette().task_bar_shadow_path(), s_last_task_bar_shadow_path, s_task_bar_shadow); load_shadow(WindowManager::the().palette().tooltip_shadow_path(), s_last_tooltip_shadow_path, s_tooltip_shadow); } @@ -201,8 +210,12 @@ Gfx::Bitmap* WindowFrame::window_shadow() const return s_menu_shadow; case WindowType::Tooltip: return s_tooltip_shadow; + case WindowType::Menubar: + return s_menu_bar_shadow; + case WindowType::Taskbar: + return s_task_bar_shadow; default: - return s_window_shadow; + return m_window.is_active() ? s_active_window_shadow : s_inactive_window_shadow; } } diff --git a/Userland/Services/WindowServer/WindowFrame.h b/Userland/Services/WindowServer/WindowFrame.h index fa838c8a5b..992ce11921 100644 --- a/Userland/Services/WindowServer/WindowFrame.h +++ b/Userland/Services/WindowServer/WindowFrame.h @@ -82,9 +82,10 @@ public: return true; } - void set_dirty() + void set_dirty(bool re_render_shadow = false) { m_dirty = true; + m_shadow_dirty |= re_render_shadow; } void theme_changed() diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index a9b4c404ca..e2dc90e86a 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -1287,6 +1287,9 @@ void WindowManager::set_active_window(Window* window, bool make_input) } else { MenuManager::the().set_current_menubar(nullptr); } + + // Window shapes may have changed (e.g. shadows for inactive/active windows) + Compositor::the().invalidate_occlusions(); } void WindowManager::set_hovered_window(Window* window)