Skip to content

Commit ac21c66

Browse files
Karol Kosekawesomekling
authored andcommitted
LibGUI: Add on_active_window_change function object to the Window class
1 parent a037e0f commit ac21c66

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Userland/Libraries/LibGUI/Window.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ void Window::handle_became_active_or_inactive_event(Core::Event& event)
491491
Application::the()->window_did_become_active({}, *this);
492492
else
493493
Application::the()->window_did_become_inactive({}, *this);
494+
if (on_active_window_change)
495+
on_active_window_change(event.type() == Event::WindowBecameActive);
494496
if (m_main_widget)
495497
m_main_widget->dispatch_event(event, this);
496498
if (m_focused_widget)

Userland/Libraries/LibGUI/Window.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class Window : public Core::Object {
8383
Function<void()> on_close;
8484
Function<CloseRequestDecision()> on_close_request;
8585
Function<void(bool is_active_input)> on_active_input_change;
86+
Function<void(bool is_active_window)> on_active_window_change;
8687

8788
int x() const { return rect().x(); }
8889
int y() const { return rect().y(); }

0 commit comments

Comments
 (0)