mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
LibWeb: Plumb wheel events from widget layer to EventHandler
This commit is contained in:
parent
53081226e9
commit
ded8c728d2
|
@ -296,6 +296,12 @@ void InProcessWebView::mouseup_event(GUI::MouseEvent& event)
|
|||
GUI::ScrollableWidget::mouseup_event(event);
|
||||
}
|
||||
|
||||
void InProcessWebView::mousewheel_event(GUI::MouseEvent& event)
|
||||
{
|
||||
page().handle_mousewheel(to_content_position(event.position()), event.button(), event.modifiers(), event.wheel_delta());
|
||||
GUI::ScrollableWidget::mousewheel_event(event);
|
||||
}
|
||||
|
||||
void InProcessWebView::keydown_event(GUI::KeyEvent& event)
|
||||
{
|
||||
bool page_accepted_event = page().handle_keydown(event.key(), event.modifiers(), event.code_point());
|
||||
|
|
|
@ -78,6 +78,7 @@ private:
|
|||
virtual void mousemove_event(GUI::MouseEvent&) override;
|
||||
virtual void mousedown_event(GUI::MouseEvent&) override;
|
||||
virtual void mouseup_event(GUI::MouseEvent&) override;
|
||||
virtual void mousewheel_event(GUI::MouseEvent&) override;
|
||||
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||
virtual void drop_event(GUI::DropEvent&) override;
|
||||
|
||||
|
|
|
@ -195,6 +195,11 @@ void OutOfProcessWebView::mousemove_event(GUI::MouseEvent& event)
|
|||
client().post_message(Messages::WebContentServer::MouseMove(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers()));
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::mousewheel_event(GUI::MouseEvent& event)
|
||||
{
|
||||
client().post_message(Messages::WebContentServer::MouseWheel(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers(), event.wheel_delta()));
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::theme_change_event(GUI::ThemeChangeEvent& event)
|
||||
{
|
||||
GUI::ScrollableWidget::theme_change_event(event);
|
||||
|
|
|
@ -78,6 +78,7 @@ private:
|
|||
virtual void mousedown_event(GUI::MouseEvent&) override;
|
||||
virtual void mouseup_event(GUI::MouseEvent&) override;
|
||||
virtual void mousemove_event(GUI::MouseEvent&) override;
|
||||
virtual void mousewheel_event(GUI::MouseEvent&) override;
|
||||
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||
virtual void theme_change_event(GUI::ThemeChangeEvent&) override;
|
||||
|
||||
|
|
|
@ -73,6 +73,11 @@ Layout::InitialContainingBlockBox* EventHandler::layout_root()
|
|||
return m_frame.document()->layout_node();
|
||||
}
|
||||
|
||||
bool EventHandler::handle_mousewheel(const Gfx::IntPoint& position, unsigned int buttons, unsigned int modifiers, int wheel_delta)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button, unsigned modifiers)
|
||||
{
|
||||
if (!layout_root())
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
||||
bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
||||
bool handle_mousemove(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers);
|
||||
bool handle_mousewheel(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta);
|
||||
|
||||
bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point);
|
||||
|
||||
|
|
|
@ -72,6 +72,11 @@ Gfx::Palette Page::palette() const
|
|||
return m_client.palette();
|
||||
}
|
||||
|
||||
bool Page::handle_mousewheel(const Gfx::IntPoint& position, unsigned button, unsigned modifiers, int wheel_delta)
|
||||
{
|
||||
return main_frame().event_handler().handle_mousewheel(position, button, modifiers, wheel_delta);
|
||||
}
|
||||
|
||||
bool Page::handle_mouseup(const Gfx::IntPoint& position, unsigned button, unsigned modifiers)
|
||||
{
|
||||
return main_frame().event_handler().handle_mouseup(position, button, modifiers);
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
||||
bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
||||
bool handle_mousemove(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers);
|
||||
bool handle_mousewheel(const Gfx::IntPoint&, unsigned button, unsigned modifiers, int wheel_delta);
|
||||
|
||||
bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point);
|
||||
|
||||
|
|
|
@ -166,6 +166,11 @@ void ClientConnection::handle(const Messages::WebContentServer::MouseUp& message
|
|||
page().handle_mouseup(message.position(), message.button(), message.modifiers());
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const Messages::WebContentServer::MouseWheel& message)
|
||||
{
|
||||
page().handle_mousewheel(message.position(), message.button(), message.modifiers(), message.wheel_delta());
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const Messages::WebContentServer::KeyDown& message)
|
||||
{
|
||||
page().handle_keydown((KeyCode)message.key(), message.modifiers(), message.code_point());
|
||||
|
|
|
@ -59,6 +59,7 @@ private:
|
|||
virtual void handle(const Messages::WebContentServer::MouseDown&) override;
|
||||
virtual void handle(const Messages::WebContentServer::MouseMove&) override;
|
||||
virtual void handle(const Messages::WebContentServer::MouseUp&) override;
|
||||
virtual void handle(const Messages::WebContentServer::MouseWheel&) override;
|
||||
virtual void handle(const Messages::WebContentServer::KeyDown&) override;
|
||||
virtual void handle(const Messages::WebContentServer::AddBackingStore&) override;
|
||||
virtual void handle(const Messages::WebContentServer::RemoveBackingStore&) override;
|
||||
|
|
|
@ -16,6 +16,7 @@ endpoint WebContentServer = 89
|
|||
MouseDown(Gfx::IntPoint position, unsigned button, unsigned buttons, unsigned modifiers) =|
|
||||
MouseMove(Gfx::IntPoint position, unsigned button, unsigned buttons, unsigned modifiers) =|
|
||||
MouseUp(Gfx::IntPoint position, unsigned button, unsigned buttons, unsigned modifiers) =|
|
||||
MouseWheel(Gfx::IntPoint position, unsigned button, unsigned buttons, unsigned modifiers, i32 wheel_delta) =|
|
||||
|
||||
KeyDown(i32 key, unsigned modifiers, u32 code_point) =|
|
||||
|
||||
|
|
Loading…
Reference in a new issue