diff options
-rw-r--r-- | Userland/Libraries/LibWeb/InProcessWebView.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/InProcessWebView.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/OutOfProcessWebView.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/OutOfProcessWebView.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Page/EventHandler.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Page/EventHandler.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Page/Page.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Page/Page.h | 1 | ||||
-rw-r--r-- | Userland/Services/WebContent/ClientConnection.cpp | 5 | ||||
-rw-r--r-- | Userland/Services/WebContent/ClientConnection.h | 1 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebContentServer.ipc | 1 |
11 files changed, 32 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/InProcessWebView.cpp b/Userland/Libraries/LibWeb/InProcessWebView.cpp index 97cc9ada41..b74cc8828c 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/InProcessWebView.cpp @@ -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()); diff --git a/Userland/Libraries/LibWeb/InProcessWebView.h b/Userland/Libraries/LibWeb/InProcessWebView.h index 62f5f96353..81538df551 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.h +++ b/Userland/Libraries/LibWeb/InProcessWebView.h @@ -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; diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index 3ca0fbdf5a..91dd9c1e46 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -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); diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h index 890860babe..0022efded8 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h @@ -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; diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index b88e760860..54cd5c7d81 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -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()) diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.h b/Userland/Libraries/LibWeb/Page/EventHandler.h index cc1cc19ade..5690454277 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.h +++ b/Userland/Libraries/LibWeb/Page/EventHandler.h @@ -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); diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp index dfc9ada662..1ec5d15666 100644 --- a/Userland/Libraries/LibWeb/Page/Page.cpp +++ b/Userland/Libraries/LibWeb/Page/Page.cpp @@ -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); diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index 66c5436b6b..589159cc48 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -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); diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index 480f8bffa6..74c4efb678 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -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()); diff --git a/Userland/Services/WebContent/ClientConnection.h b/Userland/Services/WebContent/ClientConnection.h index 39faf16165..9ea691ae49 100644 --- a/Userland/Services/WebContent/ClientConnection.h +++ b/Userland/Services/WebContent/ClientConnection.h @@ -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; diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index fd07091620..3debce25d8 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -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) =| |