mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 23:14:59 +00:00
LibGUI: Add on_activity_change function to Window
Reports changes on the active/inactive state of a window.
This commit is contained in:
parent
7739497e34
commit
dc716194c8
2 changed files with 3 additions and 0 deletions
|
@ -329,6 +329,8 @@ void Window::event(Core::Event& event)
|
||||||
|
|
||||||
if (event.type() == Event::WindowBecameActive || event.type() == Event::WindowBecameInactive) {
|
if (event.type() == Event::WindowBecameActive || event.type() == Event::WindowBecameInactive) {
|
||||||
m_is_active = event.type() == Event::WindowBecameActive;
|
m_is_active = event.type() == Event::WindowBecameActive;
|
||||||
|
if (on_activity_change)
|
||||||
|
on_activity_change(m_is_active);
|
||||||
if (m_main_widget)
|
if (m_main_widget)
|
||||||
m_main_widget->dispatch_event(event, this);
|
m_main_widget->dispatch_event(event, this);
|
||||||
if (m_focused_widget)
|
if (m_focused_widget)
|
||||||
|
|
|
@ -98,6 +98,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
Function<CloseRequestDecision()> on_close_request;
|
Function<CloseRequestDecision()> on_close_request;
|
||||||
|
Function<void(const bool is_active)> on_activity_change;
|
||||||
|
|
||||||
int x() const { return rect().x(); }
|
int x() const { return rect().x(); }
|
||||||
int y() const { return rect().y(); }
|
int y() const { return rect().y(); }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue