diff options
author | Tom <tomut@yahoo.com> | 2021-02-20 23:11:21 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-21 10:33:28 +0100 |
commit | 7143a6026da81dcdafd9647855718bee02d79bc9 (patch) | |
tree | d9ed6aca197bdac073ecaad4d90ff2140a52ce5b /Userland/Services/Taskbar | |
parent | 1c31bcb24e4b701be373f6dad567a554535fb492 (diff) | |
download | serenity-7143a6026da81dcdafd9647855718bee02d79bc9.zip |
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.
Diffstat (limited to 'Userland/Services/Taskbar')
-rw-r--r-- | Userland/Services/Taskbar/TaskbarWindow.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index 0b744f229f..1b0e344c7f 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -162,11 +162,6 @@ NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier& 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) { if (window.button()) @@ -272,8 +267,11 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) changed_event.is_active(), changed_event.is_minimized()); #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; + } auto& window = WindowList::the().ensure_window(identifier); window.set_parent_identifier({ changed_event.parent_client_id(), changed_event.parent_window_id() }); if (!window.is_modal()) |