From 03cda8a01304396f17df459a7a6e2c360b57944a Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Tue, 14 Jun 2022 19:38:32 +0200 Subject: LibWeb+LibWebView+WebContent: Get doubleclick events from LibGUI --- Userland/Libraries/LibWeb/Page/Page.cpp | 5 +++++ Userland/Libraries/LibWeb/Page/Page.h | 1 + Userland/Libraries/LibWebView/OutOfProcessWebView.cpp | 5 +++++ Userland/Libraries/LibWebView/OutOfProcessWebView.h | 1 + Userland/Services/WebContent/ConnectionFromClient.cpp | 5 +++++ Userland/Services/WebContent/ConnectionFromClient.h | 1 + Userland/Services/WebContent/WebContentServer.ipc | 1 + 7 files changed, 19 insertions(+) diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp index 98f748d40a..71c5acc05f 100644 --- a/Userland/Libraries/LibWeb/Page/Page.cpp +++ b/Userland/Libraries/LibWeb/Page/Page.cpp @@ -79,6 +79,11 @@ bool Page::handle_mousemove(Gfx::IntPoint const& position, unsigned buttons, uns return top_level_browsing_context().event_handler().handle_mousemove(position, buttons, modifiers); } +bool Page::handle_doubleclick(Gfx::IntPoint const& position, unsigned button, unsigned modifiers) +{ + return top_level_browsing_context().event_handler().handle_doubleclick(position, button, modifiers); +} + bool Page::handle_keydown(KeyCode key, unsigned modifiers, u32 code_point) { return focused_context().event_handler().handle_keydown(key, modifiers, code_point); diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index cbf6b1e35b..d4880288e1 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -51,6 +51,7 @@ public: bool handle_mousedown(Gfx::IntPoint const&, unsigned button, unsigned modifiers); bool handle_mousemove(Gfx::IntPoint const&, unsigned buttons, unsigned modifiers); bool handle_mousewheel(Gfx::IntPoint const&, unsigned button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); + bool handle_doubleclick(Gfx::IntPoint const&, unsigned buttons, unsigned modifiers); bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point); bool handle_keyup(KeyCode, unsigned modifiers, u32 code_point); diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp index f5949ed857..1e248aed52 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp @@ -184,6 +184,11 @@ void OutOfProcessWebView::mousewheel_event(GUI::MouseEvent& event) client().async_mouse_wheel(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y()); } +void OutOfProcessWebView::doubleclick_event(GUI::MouseEvent& event) +{ + client().async_doubleclick(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers()); +} + void OutOfProcessWebView::theme_change_event(GUI::ThemeChangeEvent& event) { GUI::AbstractScrollableWidget::theme_change_event(event); diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h index 3a7cf3ab15..ee24156ff8 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h @@ -123,6 +123,7 @@ private: virtual void mouseup_event(GUI::MouseEvent&) override; virtual void mousemove_event(GUI::MouseEvent&) override; virtual void mousewheel_event(GUI::MouseEvent&) override; + virtual void doubleclick_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; diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index 89f7620de7..89f03fa9ea 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -163,6 +163,11 @@ void ConnectionFromClient::mouse_wheel(Gfx::IntPoint const& position, unsigned i page().handle_mousewheel(position, button, modifiers, wheel_delta_x, wheel_delta_y); } +void ConnectionFromClient::doubleclick(Gfx::IntPoint const& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers) +{ + page().handle_doubleclick(position, button, modifiers); +} + void ConnectionFromClient::key_down(i32 key, unsigned int modifiers, u32 code_point) { page().handle_keydown((KeyCode)key, modifiers, code_point); diff --git a/Userland/Services/WebContent/ConnectionFromClient.h b/Userland/Services/WebContent/ConnectionFromClient.h index a9e1535220..943e4ff359 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.h +++ b/Userland/Services/WebContent/ConnectionFromClient.h @@ -48,6 +48,7 @@ private: virtual void mouse_move(Gfx::IntPoint const&, unsigned, unsigned, unsigned) override; virtual void mouse_up(Gfx::IntPoint const&, unsigned, unsigned, unsigned) override; virtual void mouse_wheel(Gfx::IntPoint const&, unsigned, unsigned, unsigned, i32, i32) override; + virtual void doubleclick(Gfx::IntPoint const&, unsigned, unsigned, unsigned) 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; diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index dca0221d36..418c33a32d 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -23,6 +23,7 @@ endpoint WebContentServer mouse_move(Gfx::IntPoint position, unsigned button, unsigned buttons, unsigned modifiers) =| mouse_up(Gfx::IntPoint position, unsigned button, unsigned buttons, unsigned modifiers) =| mouse_wheel(Gfx::IntPoint position, unsigned button, unsigned buttons, unsigned modifiers, i32 wheel_delta_x, i32 wheel_delta_y) =| + doubleclick(Gfx::IntPoint position, unsigned button, unsigned buttons, unsigned modifiers) =| key_down(i32 key, unsigned modifiers, u32 code_point) =| key_up(i32 key, unsigned modifiers, u32 code_point) =| -- cgit v1.2.3