1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:07:45 +00:00

Taskbar: Don't create buttons for modal windows

Since the user can't really do much with windows that are blocked
by a modal window, there is no point in showing multiple buttons.
This commit is contained in:
Tom 2020-07-15 17:44:42 -06:00 committed by Andreas Kling
parent bbdf0665fc
commit a269e3e573
5 changed files with 114 additions and 24 deletions

View file

@ -25,7 +25,6 @@
*/
#include "WindowList.h"
#include <LibGUI/WindowServerConnection.h>
WindowList& WindowList::the()
{
@ -35,6 +34,19 @@ WindowList& WindowList::the()
return *s_the;
}
Window* WindowList::find_parent(const Window& window)
{
if (!window.parent_identifier().is_valid())
return nullptr;
for (auto& it : m_windows)
{
auto& w = *it.value;
if (w.identifier() == window.parent_identifier())
return &w;
}
return nullptr;
}
Window* WindowList::window(const WindowIdentifier& identifier)
{
auto it = m_windows.find(identifier);
@ -49,14 +61,6 @@ Window& WindowList::ensure_window(const WindowIdentifier& identifier)
if (it != m_windows.end())
return *it->value;
auto window = make<Window>(identifier);
window->set_button(aid_create_button(identifier));
window->button()->on_click = [window = window.ptr(), identifier](auto) {
if (window->is_minimized() || !window->is_active()) {
GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_SetActiveWindow(identifier.client_id(), identifier.window_id()));
} else {
GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_SetWindowMinimized(identifier.client_id(), identifier.window_id(), true));
}
};
auto& window_ref = *window;
m_windows.set(identifier, move(window));
return window_ref;