1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 16:35:08 +00:00

LibGUI: Add GUI::Application::active_window()

Instead of each window having a bool flag that says whether that window
is currently active, have a pointer to the active window on the app
object instead.
This commit is contained in:
Andreas Kling 2021-01-05 15:43:59 +01:00
parent 8b90e8d08b
commit 1c8eaf28cd
4 changed files with 31 additions and 3 deletions

View file

@ -235,4 +235,16 @@ void Application::tooltip_hide_timer_did_fire()
m_tooltip_window->hide();
}
void Application::window_did_become_active(Badge<Window>, Window& window)
{
m_active_window = window.make_weak_ptr<Window>();
}
void Application::window_did_become_inactive(Badge<Window>, Window& window)
{
if (m_active_window.ptr() != &window)
return;
m_active_window = nullptr;
}
}