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

LibWeb: Fire "keyup" events as well :^)

This was easy, now that we have KeyboardEvent.
This commit is contained in:
Andreas Kling 2021-09-28 15:39:35 +02:00
parent 554c344ffe
commit 0af0ee4293
10 changed files with 28 additions and 0 deletions

View file

@ -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)

View file

@ -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*);

View file

@ -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);
}
}

View file

@ -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;