1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:27:34 +00:00

WindowServer+LibGUI: Notify GUI clients about menu item enter/leave

We now send out MenuItemEntered and MenuItemLeft messages to the client
when the user hovers/unhovers menu items.

On the client side, these become GUI::ActionEvent, with one of two
types: ActionEnter or ActionLeave. They are sent to the Application.

This will allow GUI applications to react to these events.
This commit is contained in:
Andreas Kling 2021-04-17 18:16:54 +02:00
parent f8c2beec7c
commit ba7e1ca2fb
7 changed files with 91 additions and 19 deletions

View file

@ -31,6 +31,7 @@
#include <Kernel/API/KeyCode.h>
#include <LibCore/Event.h>
#include <LibGUI/FocusSource.h>
#include <LibGUI/Forward.h>
#include <LibGUI/WindowType.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Point.h>
@ -72,6 +73,8 @@ public:
Drop,
ThemeChange,
ScreenRectChange,
ActionEnter,
ActionLeave,
__Begin_WM_Events,
WM_WindowRemoved,
@ -428,4 +431,16 @@ private:
FocusSource m_source { FocusSource::Programmatic };
};
class ActionEvent final : public Event {
public:
ActionEvent(Type, Action&);
~ActionEvent();
Action const& action() const { return *m_action; }
Action& action() { return *m_action; }
private:
NonnullRefPtr<Action> m_action;
};
}