mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
WindowServer+Base: Show alternate close button for "modified" windows
Windows that are marked as modified will now have another (themable) close button. This gives an additional visual clue that some action will be required by the user before the window gets closed. The default window-close-modified icon is an "X" with "..." underneath, building on the established use of "..." in menus to signify that additional user input will be required before an action is completed.
This commit is contained in:
parent
819325892a
commit
f052a66c5d
Notes:
sideshowbarker
2024-07-18 18:47:09 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/f052a66c5dd
8 changed files with 13 additions and 2 deletions
BIN
Base/res/icons/16x16/window-close-modified-2x.png
Normal file
BIN
Base/res/icons/16x16/window-close-modified-2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 B |
BIN
Base/res/icons/16x16/window-close-modified.png
Normal file
BIN
Base/res/icons/16x16/window-close-modified.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 111 B |
BIN
Base/res/icons/themes/Coffee/16x16/window-close-modified.png
Normal file
BIN
Base/res/icons/themes/Coffee/16x16/window-close-modified.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 831 B |
BIN
Base/res/icons/themes/Redmond/16x16/window-close-modified.png
Normal file
BIN
Base/res/icons/themes/Redmond/16x16/window-close-modified.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 99 B |
BIN
Base/res/icons/themes/Sunshine/16x16/window-close-modified.png
Normal file
BIN
Base/res/icons/themes/Sunshine/16x16/window-close-modified.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 253 B |
|
@ -998,6 +998,7 @@ void Window::set_modified(bool modified)
|
|||
return;
|
||||
|
||||
m_modified = modified;
|
||||
frame().set_button_icons();
|
||||
frame().invalidate_titlebar();
|
||||
}
|
||||
|
||||
|
|
|
@ -371,6 +371,7 @@ private:
|
|||
bool m_invalidated_all { true };
|
||||
bool m_invalidated_frame { true };
|
||||
bool m_hit_testing_enabled { true };
|
||||
bool m_modified { false };
|
||||
WindowTileType m_tiled { WindowTileType::None };
|
||||
Gfx::IntRect m_untiled_rect;
|
||||
bool m_occluded { false };
|
||||
|
@ -400,7 +401,6 @@ private:
|
|||
int m_minimize_animation_step { -1 };
|
||||
Optional<int> m_progress;
|
||||
bool m_should_show_menubar { true };
|
||||
bool m_modified { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ static Gfx::Bitmap* s_minimize_icon;
|
|||
static Gfx::Bitmap* s_maximize_icon;
|
||||
static Gfx::Bitmap* s_restore_icon;
|
||||
static Gfx::Bitmap* s_close_icon;
|
||||
static Gfx::Bitmap* s_close_modified_icon;
|
||||
|
||||
static String s_last_title_button_icons_path;
|
||||
static int s_last_title_button_icons_scale;
|
||||
|
@ -102,7 +103,7 @@ void WindowFrame::set_button_icons()
|
|||
if (m_window.is_frameless())
|
||||
return;
|
||||
|
||||
m_close_button->set_icon(*s_close_icon);
|
||||
m_close_button->set_icon(m_window.is_modified() ? *s_close_modified_icon : *s_close_icon);
|
||||
if (m_window.is_minimizable())
|
||||
m_minimize_button->set_icon(*s_minimize_icon);
|
||||
if (m_window.is_resizable())
|
||||
|
@ -151,6 +152,15 @@ void WindowFrame::reload_config()
|
|||
s_close_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-close.png", icons_scale).leak_ref();
|
||||
full_path.clear();
|
||||
}
|
||||
if (!s_close_modified_icon || s_last_title_button_icons_path != icons_path || s_last_title_button_icons_scale != icons_scale) {
|
||||
full_path.append(icons_path);
|
||||
full_path.append("window-close-modified.png");
|
||||
if (s_close_modified_icon)
|
||||
s_close_modified_icon->unref();
|
||||
if (!(s_close_modified_icon = Gfx::Bitmap::load_from_file(full_path.to_string(), icons_scale).leak_ref()))
|
||||
s_close_modified_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-close-modified.png", icons_scale).leak_ref();
|
||||
full_path.clear();
|
||||
}
|
||||
|
||||
s_last_title_button_icons_path = icons_path;
|
||||
s_last_title_button_icons_scale = icons_scale;
|
||||
|
|
Loading…
Reference in a new issue