1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:37:34 +00:00

WindowServer: Allow different shadows for active/inactive windows

Also allow specifying different shadows for the task and menu bar.
This commit is contained in:
Tom 2021-02-11 15:12:19 -07:00 committed by Andreas Kling
parent 8c694ed6eb
commit cf1c159ed5
10 changed files with 41 additions and 12 deletions

View file

@ -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();
}

View file

@ -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;
}
}

View file

@ -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()

View file

@ -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)