mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:28:12 +00:00
WindowServer: Fix switching between shadows and no shadows with themes
We weren't properly handling switching between having a shadow and not having a shadow when switching themes. This allows an empty string in the theme configuration for a shadow path, meaning no shadow should be rendered.
This commit is contained in:
parent
5d4c4bd372
commit
a807d92a32
4 changed files with 25 additions and 11 deletions
|
@ -169,9 +169,20 @@ void WindowFrame::reload_config()
|
|||
s_last_title_button_icons_scale = icons_scale;
|
||||
|
||||
auto load_shadow = [](const String& path, String& last_path, Gfx::Bitmap*& shadow_bitmap) {
|
||||
if (!shadow_bitmap || shadow_bitmap->scale() != s_last_title_button_icons_scale || last_path != path) {
|
||||
if (path.is_empty()) {
|
||||
last_path = String::empty();
|
||||
if (shadow_bitmap) {
|
||||
shadow_bitmap->unref();
|
||||
shadow_bitmap = nullptr;
|
||||
}
|
||||
} else if (!shadow_bitmap || shadow_bitmap->scale() != s_last_title_button_icons_scale || last_path != path) {
|
||||
if (shadow_bitmap)
|
||||
shadow_bitmap->unref();
|
||||
shadow_bitmap = Gfx::Bitmap::load_from_file(path, s_last_title_button_icons_scale).leak_ref();
|
||||
last_path = path;
|
||||
if (shadow_bitmap)
|
||||
last_path = path;
|
||||
else
|
||||
last_path = String::empty();
|
||||
}
|
||||
};
|
||||
load_shadow(WindowManager::the().palette().window_shadow_path(), s_last_window_shadow_path, s_window_shadow);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue