summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions/qwaylandxdgshellv6integration.cpp
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@liri.io>2019-08-29 15:03:02 +0200
committerPier Luigi Fiorini <pierluigi.fiorini@liri.io>2019-09-05 09:42:19 +0200
commita85e1542de6fcd84de22955c8aa764e8c8317331 (patch)
tree37cfef9d3b6b76610f948f038950dc981f486abb /src/compositor/extensions/qwaylandxdgshellv6integration.cpp
parentf1148d63430347af03827c995bf68f86793c7ae0 (diff)
Improve QWaylandQuickShellIntegration API
During the API review we came up with an improved API. QWaylandQuickShellIntegration now filter events delivered to QWaylandQuickShellSurfaceItem using QObject event filter, thus we don't need a new API anymore. Change-Id: I91b05c4c8ecee56cd782f036160c569cd972abdb Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/compositor/extensions/qwaylandxdgshellv6integration.cpp')
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6integration.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp b/src/compositor/extensions/qwaylandxdgshellv6integration.cpp
index 66dbc6841..e424af193 100644
--- a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellv6integration.cpp
@@ -77,7 +77,19 @@ XdgToplevelV6Integration::XdgToplevelV6Integration(QWaylandQuickShellSurfaceItem
connect(m_toplevel, &QObject::destroyed, this, &XdgToplevelV6Integration::handleToplevelDestroyed);
}
-bool XdgToplevelV6Integration::mouseMoveEvent(QMouseEvent *event)
+bool XdgToplevelV6Integration::eventFilter(QObject *object, QEvent *event)
+{
+ if (event->type() == QEvent::MouseMove) {
+ QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+ return filterMouseMoveEvent(mouseEvent);
+ } else if (event->type() == QEvent::MouseButtonRelease) {
+ QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+ return filterMouseReleaseEvent(mouseEvent);
+ }
+ return QWaylandQuickShellIntegration::eventFilter(object, event);
+}
+
+bool XdgToplevelV6Integration::filterMouseMoveEvent(QMouseEvent *event)
{
if (grabberState == GrabberState::Resize) {
Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event));
@@ -105,7 +117,7 @@ bool XdgToplevelV6Integration::mouseMoveEvent(QMouseEvent *event)
return false;
}
-bool XdgToplevelV6Integration::mouseReleaseEvent(QMouseEvent *event)
+bool XdgToplevelV6Integration::filterMouseReleaseEvent(QMouseEvent *event)
{
Q_UNUSED(event);