diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-02-06 13:36:03 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-03-05 12:26:08 +0000 |
commit | 23f8d1209399d0c1cab46362143fa7bf1dd69182 (patch) | |
tree | 2dea1c188262b71cccab72f0bf5e2482d529520f | |
parent | 2c01e52f098c5a1cd7bb653b3e49fd2e02f11a60 (diff) | |
download | qtwayland-23f8d1209399d0c1cab46362143fa7bf1dd69182.tar.gz |
Client: Implement QPlatformWindow::startSystemMove()
Hooks into what we already use for the window decorations.
Task-number: QTBUG-58044
Change-Id: Idcd971f69d52a5bb760bb6bffb26e9f5bdd429df
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r-- | src/client/qwaylandshellsurface_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandwindow.cpp | 8 | ||||
-rw-r--r-- | src/client/qwaylandwindow_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandwlshellsurface.cpp | 3 | ||||
-rw-r--r-- | src/client/qwaylandwlshellsurface_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandxdgshellv6.cpp | 9 | ||||
-rw-r--r-- | src/client/qwaylandxdgshellv6_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandxdgsurface.cpp | 3 | ||||
-rw-r--r-- | src/client/qwaylandxdgsurface_p.h | 2 |
9 files changed, 24 insertions, 9 deletions
diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h index 72bef918..fdc309a6 100644 --- a/src/client/qwaylandshellsurface_p.h +++ b/src/client/qwaylandshellsurface_p.h @@ -78,7 +78,7 @@ public: virtual void resize(QWaylandInputDevice * /*inputDevice*/, enum wl_shell_surface_resize /*edges*/) {} - virtual void move(QWaylandInputDevice * /*inputDevice*/) {} + virtual bool move(QWaylandInputDevice *) { return false; } virtual void setTitle(const QString & /*title*/) {} virtual void setAppId(const QString & /*appId*/) {} diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 52461dc3..ecab8ffc 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -1045,6 +1045,14 @@ void QWaylandWindow::addAttachOffset(const QPoint point) mOffset += point; } +bool QtWaylandClient::QWaylandWindow::startSystemMove(const QPoint &pos) +{ + Q_UNUSED(pos); + if (auto seat = display()->lastInputDevice()) + return mShellSurface && mShellSurface->move(seat); + return false; +} + } QT_END_NAMESPACE diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index 0680b14e..3324bf70 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -201,6 +201,8 @@ public: void propagateSizeHints() override { } void addAttachOffset(const QPoint point); + bool startSystemMove(const QPoint &pos) override; + void requestUpdate() override; public slots: diff --git a/src/client/qwaylandwlshellsurface.cpp b/src/client/qwaylandwlshellsurface.cpp index 00b070f3..f1b0bd2c 100644 --- a/src/client/qwaylandwlshellsurface.cpp +++ b/src/client/qwaylandwlshellsurface.cpp @@ -74,10 +74,11 @@ void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_sh edges); } -void QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice) +bool QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice) { move(inputDevice->wl_seat(), inputDevice->serial()); + return true; } void QWaylandWlShellSurface::setTitle(const QString & title) diff --git a/src/client/qwaylandwlshellsurface_p.h b/src/client/qwaylandwlshellsurface_p.h index f9ac1bb4..497ec604 100644 --- a/src/client/qwaylandwlshellsurface_p.h +++ b/src/client/qwaylandwlshellsurface_p.h @@ -81,7 +81,7 @@ public: void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; using QtWayland::wl_shell_surface::move; - void move(QWaylandInputDevice *inputDevice) override; + bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString & title) override; void setAppId(const QString &appId) override; diff --git a/src/client/qwaylandxdgshellv6.cpp b/src/client/qwaylandxdgshellv6.cpp index 69bbf55b..c89c8316 100644 --- a/src/client/qwaylandxdgshellv6.cpp +++ b/src/client/qwaylandxdgshellv6.cpp @@ -142,10 +142,13 @@ void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, enum wl_shel } -void QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) +bool QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) { - Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); - m_toplevel->move(inputDevice->wl_seat(), inputDevice->serial()); + if (m_toplevel && m_toplevel->isInitialized()) { + m_toplevel->move(inputDevice->wl_seat(), inputDevice->serial()); + return true; + } + return false; } void QWaylandXdgSurfaceV6::setTitle(const QString &title) diff --git a/src/client/qwaylandxdgshellv6_p.h b/src/client/qwaylandxdgshellv6_p.h index baaf3807..b72d3d18 100644 --- a/src/client/qwaylandxdgshellv6_p.h +++ b/src/client/qwaylandxdgshellv6_p.h @@ -79,7 +79,7 @@ public: void resize(QWaylandInputDevice *inputDevice, enum zxdg_toplevel_v6_resize_edge edges); void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; - void move(QWaylandInputDevice *inputDevice) override; + bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; diff --git a/src/client/qwaylandxdgsurface.cpp b/src/client/qwaylandxdgsurface.cpp index 40ed9f07..4dfc5e6d 100644 --- a/src/client/qwaylandxdgsurface.cpp +++ b/src/client/qwaylandxdgsurface.cpp @@ -85,10 +85,11 @@ void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum resize_ed edges); } -void QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) +bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) { move(inputDevice->wl_seat(), inputDevice->serial()); + return true; } void QWaylandXdgSurface::setMaximized() diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h index 9fcecca7..b8dd93f4 100644 --- a/src/client/qwaylandxdgsurface_p.h +++ b/src/client/qwaylandxdgsurface_p.h @@ -85,7 +85,7 @@ public: void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; using QtWayland::xdg_surface::move; - void move(QWaylandInputDevice *inputDevice) override; + bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; |