mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 21:15:14 +00:00
LibWeb: Fire "keyup" events as well :^)
This was easy, now that we have KeyboardEvent.
This commit is contained in:
parent
554c344ffe
commit
0af0ee4293
Notes:
sideshowbarker
2024-07-18 03:22:27 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0af0ee42936
10 changed files with 28 additions and 0 deletions
|
@ -161,6 +161,11 @@ void OutOfProcessWebView::keydown_event(GUI::KeyEvent& event)
|
|||
client().async_key_down(event.key(), event.modifiers(), event.code_point());
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::keyup_event(GUI::KeyEvent& event)
|
||||
{
|
||||
client().async_key_up(event.key(), event.modifiers(), event.code_point());
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::mousedown_event(GUI::MouseEvent& event)
|
||||
{
|
||||
client().async_mouse_down(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers());
|
||||
|
|
|
@ -96,6 +96,7 @@ private:
|
|||
virtual void mousemove_event(GUI::MouseEvent&) override;
|
||||
virtual void mousewheel_event(GUI::MouseEvent&) override;
|
||||
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||
virtual void keyup_event(GUI::KeyEvent&) override;
|
||||
virtual void theme_change_event(GUI::ThemeChangeEvent&) override;
|
||||
virtual void screen_rects_change_event(GUI::ScreenRectsChangeEvent&) override;
|
||||
|
||||
|
|
|
@ -460,6 +460,13 @@ bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_poin
|
|||
return m_frame.active_document()->window().dispatch_event(move(event));
|
||||
}
|
||||
|
||||
bool EventHandler::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point)
|
||||
{
|
||||
auto event = UIEvents::KeyboardEvent::create_from_platform_event(UIEvents::EventNames::keyup, key, modifiers, code_point);
|
||||
// FIXME: Figure out the right event target.
|
||||
return m_frame.active_document()->window().dispatch_event(move(event));
|
||||
}
|
||||
|
||||
void EventHandler::set_mouse_event_tracking_layout_node(Layout::Node* layout_node)
|
||||
{
|
||||
if (layout_node)
|
||||
|
|
|
@ -30,6 +30,7 @@ public:
|
|||
bool handle_mousewheel(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta);
|
||||
|
||||
bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point);
|
||||
bool handle_keyup(KeyCode, unsigned modifiers, u32 code_point);
|
||||
|
||||
void set_mouse_event_tracking_layout_node(Layout::Node*);
|
||||
|
||||
|
|
|
@ -81,4 +81,9 @@ bool Page::handle_keydown(KeyCode key, unsigned modifiers, u32 code_point)
|
|||
return focused_context().event_handler().handle_keydown(key, modifiers, code_point);
|
||||
}
|
||||
|
||||
bool Page::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point)
|
||||
{
|
||||
return focused_context().event_handler().handle_keyup(key, modifiers, code_point);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
bool handle_mousewheel(const Gfx::IntPoint&, unsigned button, unsigned modifiers, int wheel_delta);
|
||||
|
||||
bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point);
|
||||
bool handle_keyup(KeyCode, unsigned modifiers, u32 code_point);
|
||||
|
||||
Gfx::Palette palette() const;
|
||||
Gfx::IntRect screen_rect() const;
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace Web::UIEvents::EventNames {
|
|||
#define ENUMERATE_UI_EVENTS \
|
||||
__ENUMERATE_UI_EVENT(click) \
|
||||
__ENUMERATE_UI_EVENT(keydown) \
|
||||
__ENUMERATE_UI_EVENT(keyup) \
|
||||
__ENUMERATE_UI_EVENT(mousedown) \
|
||||
__ENUMERATE_UI_EVENT(mouseenter) \
|
||||
__ENUMERATE_UI_EVENT(mouseleave) \
|
||||
|
|
|
@ -169,6 +169,11 @@ void ClientConnection::key_down(i32 key, unsigned int modifiers, u32 code_point)
|
|||
page().handle_keydown((KeyCode)key, modifiers, code_point);
|
||||
}
|
||||
|
||||
void ClientConnection::key_up(i32 key, unsigned int modifiers, u32 code_point)
|
||||
{
|
||||
page().handle_keyup((KeyCode)key, modifiers, code_point);
|
||||
}
|
||||
|
||||
void ClientConnection::debug_request(const String& request, const String& argument)
|
||||
{
|
||||
if (request == "dump-dom-tree") {
|
||||
|
|
|
@ -47,6 +47,7 @@ private:
|
|||
virtual void mouse_up(Gfx::IntPoint const&, unsigned, unsigned, unsigned) override;
|
||||
virtual void mouse_wheel(Gfx::IntPoint const&, unsigned, unsigned, unsigned, i32) override;
|
||||
virtual void key_down(i32, unsigned, u32) override;
|
||||
virtual void key_up(i32, unsigned, u32) override;
|
||||
virtual void add_backing_store(i32, Gfx::ShareableBitmap const&) override;
|
||||
virtual void remove_backing_store(i32) override;
|
||||
virtual void debug_request(String const&, String const&) override;
|
||||
|
|
|
@ -23,6 +23,7 @@ endpoint WebContentServer
|
|||
mouse_wheel(Gfx::IntPoint position, unsigned button, unsigned buttons, unsigned modifiers, i32 wheel_delta) =|
|
||||
|
||||
key_down(i32 key, unsigned modifiers, u32 code_point) =|
|
||||
key_up(i32 key, unsigned modifiers, u32 code_point) =|
|
||||
|
||||
debug_request(String request, String argument) =|
|
||||
get_source() =|
|
||||
|
|
Loading…
Add table
Reference in a new issue