summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-02 11:49:20 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-13 13:04:50 +0200
commit98ecea4b23c2e3122fda6e5b1df0e23a56d93ffe (patch)
tree27b6d437d257da9e70d7987c76f291bb59c67edf
parenta34b3a4e804e44133d8b3d9ab27952cfb6a84b50 (diff)
Parse forward and back mouse buttons
It appears we have support for it on all levels. Fixes: QTBUG-85360 Change-Id: I68d03931197a3b883a1909e96096000fb84925bf Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
-rw-r--r--src/core/render_widget_host_view_qt.cpp2
-rw-r--r--src/core/web_event_factory.cpp16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index dd4965de5..ef56e451d 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -1742,7 +1742,7 @@ void RenderWidgetHostViewQt::handlePointerEvent(T *event)
blink::WebMouseEvent webEvent = WebEventFactory::toWebMouseEvent(event);
if ((webEvent.GetType() == blink::WebInputEvent::kMouseDown || webEvent.GetType() == blink::WebInputEvent::kMouseUp)
&& webEvent.button == blink::WebMouseEvent::Button::kNoButton) {
- // Blink can only handle the 3 main mouse-buttons and may assert when processing mouse-down for no button.
+ // Blink can only handle the 5 main mouse-buttons and may assert when processing mouse-down for no button.
LOG(INFO) << "Unhandled mouse button";
return;
}
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index e1db69b16..32d79049d 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -1229,6 +1229,10 @@ static WebMouseEvent::Button mouseButtonForEvent(T *event)
return WebMouseEvent::Button::kRight;
else if (event->button() == Qt::MidButton)
return WebMouseEvent::Button::kMiddle;
+ else if (event->button() == Qt::BackButton)
+ return WebMouseEvent::Button::kBack;
+ else if (event->button() == Qt::ForwardButton)
+ return WebMouseEvent::Button::kForward;
if (event->type() != QEvent::MouseMove && event->type() != QEvent::TabletMove)
return WebMouseEvent::Button::kNoButton;
@@ -1241,6 +1245,10 @@ static WebMouseEvent::Button mouseButtonForEvent(T *event)
return WebMouseEvent::Button::kRight;
else if (event->buttons() & Qt::MidButton)
return WebMouseEvent::Button::kMiddle;
+ else if (event->buttons() & Qt::BackButton)
+ return WebMouseEvent::Button::kBack;
+ else if (event->buttons() & Qt::ForwardButton)
+ return WebMouseEvent::Button::kForward;
return WebMouseEvent::Button::kNoButton;
}
@@ -1255,6 +1263,10 @@ static unsigned mouseButtonsModifiersForEvent(const T* event)
ret |= WebInputEvent::kRightButtonDown;
if (event->buttons() & Qt::MidButton)
ret |= WebInputEvent::kMiddleButtonDown;
+ if (event->buttons() & Qt::BackButton)
+ ret |= WebInputEvent::kBackButtonDown;
+ if (event->buttons() & Qt::ForwardButton)
+ ret |= WebInputEvent::kForwardButtonDown;
return ret;
}
@@ -1348,6 +1360,10 @@ static inline Qt::MouseButtons mouseButtonsForModifier(unsigned int modifier)
buttons |= Qt::RightButton;
if (modifier & WebInputEvent::kMiddleButtonDown)
buttons |= Qt::MiddleButton;
+ if (modifier & WebInputEvent::kBackButtonDown)
+ buttons |= Qt::BackButton;
+ if (modifier & WebInputEvent::kForwardButtonDown)
+ buttons |= Qt::ForwardButton;
return buttons;
}