mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:37:34 +00:00
Taskbar: Remove window button if a window state change demands it
We didn't add buttons for certain window types or states when the window was created, but when a window with a button changed its state to where we would not have created the button, we didn't remove the existing button.
This commit is contained in:
parent
1c31bcb24e
commit
7143a6026d
1 changed files with 4 additions and 6 deletions
|
@ -162,11 +162,6 @@ NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier&
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool should_include_window(GUI::WindowType window_type, bool is_frameless)
|
|
||||||
{
|
|
||||||
return window_type == GUI::WindowType::Normal && !is_frameless;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskbarWindow::add_window_button(::Window& window, const WindowIdentifier& identifier)
|
void TaskbarWindow::add_window_button(::Window& window, const WindowIdentifier& identifier)
|
||||||
{
|
{
|
||||||
if (window.button())
|
if (window.button())
|
||||||
|
@ -272,8 +267,11 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
|
||||||
changed_event.is_active(),
|
changed_event.is_active(),
|
||||||
changed_event.is_minimized());
|
changed_event.is_minimized());
|
||||||
#endif
|
#endif
|
||||||
if (!should_include_window(changed_event.window_type(), changed_event.is_frameless()))
|
if (changed_event.window_type() != GUI::WindowType::Normal || changed_event.is_frameless()) {
|
||||||
|
if (auto* window = WindowList::the().window(identifier))
|
||||||
|
remove_window_button(*window, false);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
auto& window = WindowList::the().ensure_window(identifier);
|
auto& window = WindowList::the().ensure_window(identifier);
|
||||||
window.set_parent_identifier({ changed_event.parent_client_id(), changed_event.parent_window_id() });
|
window.set_parent_identifier({ changed_event.parent_client_id(), changed_event.parent_window_id() });
|
||||||
if (!window.is_modal())
|
if (!window.is_modal())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue