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>
This commit is contained in:
Johan Klokkhammer Helsing 2018-02-06 13:36:03 +01:00 committed by Johan Helsing
parent 01d0594c9e
commit 2d468ebfa5
9 changed files with 24 additions and 9 deletions

View File

@ -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*/) {}

View File

@ -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

View File

@ -201,6 +201,8 @@ public:
void propagateSizeHints() override { }
void addAttachOffset(const QPoint point);
bool startSystemMove(const QPoint &pos) override;
void requestUpdate() override;
public slots:

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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()

View File

@ -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;