1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:17:35 +00:00

LibGUI: Make focus events more aware of why focus is changing

This patch adds GUI::FocusEvent which has a GUI::FocusSource.
The focus source is one of three things:

- Programmatic
- Mouse
- Keyboard

This allows receivers of focus events to implement different behaviors
depending on how they receive/lose focus.
This commit is contained in:
Andreas Kling 2020-08-14 19:56:40 +02:00
parent 110b3d89d3
commit 75b8f4e4e6
14 changed files with 94 additions and 41 deletions

View file

@ -30,6 +30,7 @@
#include <AK/String.h>
#include <AK/WeakPtr.h>
#include <LibCore/Object.h>
#include <LibGUI/FocusSource.h>
#include <LibGUI/Forward.h>
#include <LibGUI/WindowType.h>
#include <LibGfx/Color.h>
@ -152,7 +153,7 @@ public:
Widget* focused_widget() { return m_focused_widget; }
const Widget* focused_widget() const { return m_focused_widget; }
void set_focused_widget(Widget*);
void set_focused_widget(Widget*, FocusSource = FocusSource::Programmatic);
void update();
void update(const Gfx::IntRect&);