summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2023-05-13 15:55:10 +0100
committerAndreas Kling <kling@serenityos.org>2023-05-14 13:51:05 +0200
commit3894a8b995908d81e18565aa87b1c78d7217d955 (patch)
tree5fd47f3f4629c8303ff8473ae82c899ba1602720
parente2b1f9447cd2fc32670568a7cf3f539e33b81e7a (diff)
downloadserenity-3894a8b995908d81e18565aa87b1c78d7217d955.zip
Ladybird: Send the double click event to WebContent
-rw-r--r--Ladybird/WebContentView.cpp15
-rw-r--r--Ladybird/WebContentView.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp
index 20f9781b8b..6e6a3ff840 100644
--- a/Ladybird/WebContentView.cpp
+++ b/Ladybird/WebContentView.cpp
@@ -314,6 +314,21 @@ void WebContentView::mouseReleaseEvent(QMouseEvent* event)
client().async_mouse_up(to_content(position), button, buttons, modifiers);
}
+void WebContentView::mouseDoubleClickEvent(QMouseEvent* event)
+{
+ Gfx::IntPoint position(event->position().x() / m_inverse_pixel_scaling_ratio, event->position().y() / m_inverse_pixel_scaling_ratio);
+ auto button = get_button_from_qt_event(*event);
+ if (button == 0) {
+ // We could not convert Qt buttons to something that Lagom can
+ // recognize - don't even bother propagating this to the web engine
+ // as it will not handle it anyway, and it will (currently) assert
+ return;
+ }
+ auto modifiers = get_modifiers_from_qt_mouse_event(*event);
+ auto buttons = get_buttons_from_qt_event(*event);
+ client().async_doubleclick(to_content(position), button, buttons, modifiers);
+}
+
void WebContentView::dragEnterEvent(QDragEnterEvent* event)
{
if (event->mimeData()->hasUrls())
diff --git a/Ladybird/WebContentView.h b/Ladybird/WebContentView.h
index a51cfed348..d318372090 100644
--- a/Ladybird/WebContentView.h
+++ b/Ladybird/WebContentView.h
@@ -79,6 +79,7 @@ public:
virtual void mouseMoveEvent(QMouseEvent*) override;
virtual void mousePressEvent(QMouseEvent*) override;
virtual void mouseReleaseEvent(QMouseEvent*) override;
+ virtual void mouseDoubleClickEvent(QMouseEvent*) override;
virtual void dragEnterEvent(QDragEnterEvent*) override;
virtual void dropEvent(QDropEvent*) override;
virtual void keyPressEvent(QKeyEvent* event) override;