mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
LibWebView+WebContent: Use Web::InputEvent for WebContent input IPC
Now that all input events are handled by LibWebView, replace the IPCs which send the fields of Web::KeyEvent / Web::MouseEvent individually with one IPC per event type (key or mouse). We can also replace the ad-hoc queued input structure with a smaller struct that simply holds the tranferred Web::KeyEvent / Web::MouseEvent. In the future, we can also adapt Web::EventHandler to use these structs.
This commit is contained in:
parent
2c31ef11bc
commit
baf359354b
8 changed files with 164 additions and 228 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/OwnPtr.h>
|
||||
#include <AK/Variant.h>
|
||||
#include <LibGfx/Point.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
|
||||
// FIXME: These should not be included outside of Serenity. This FIXME appears in several locations across the Ladybird
|
||||
|
@ -29,6 +30,8 @@ public:
|
|||
KeyUp,
|
||||
};
|
||||
|
||||
KeyEvent clone_without_chrome_data() const;
|
||||
|
||||
Type type;
|
||||
KeyCode key { KeyCode::Key_Invalid };
|
||||
KeyModifier modifiers { KeyModifier::Mod_None };
|
||||
|
@ -47,6 +50,8 @@ public:
|
|||
DoubleClick,
|
||||
};
|
||||
|
||||
MouseEvent clone_without_chrome_data() const;
|
||||
|
||||
Type type;
|
||||
Web::DevicePixelPoint position;
|
||||
Web::DevicePixelPoint screen_position;
|
||||
|
@ -62,3 +67,19 @@ public:
|
|||
using InputEvent = Variant<KeyEvent, MouseEvent>;
|
||||
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder&, Web::KeyEvent const&);
|
||||
|
||||
template<>
|
||||
ErrorOr<Web::KeyEvent> decode(Decoder&);
|
||||
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder&, Web::MouseEvent const&);
|
||||
|
||||
template<>
|
||||
ErrorOr<Web::MouseEvent> decode(Decoder&);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue