Client: Implement QPlatformWindow::startSystemResize

Task-number: QTBUG-73011
Change-Id: Ife0d9949b4d4dd7e6f16d3de88d0cb4bf4991e09
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Johan Klokkhammer Helsing 2019-01-14 09:38:51 +01:00
parent 37b79a5968
commit 84209cf53b
11 changed files with 27 additions and 12 deletions

View File

@ -76,10 +76,11 @@ QWaylandWlShellSurface::~QWaylandWlShellSurface()
delete m_extendedWindow;
}
void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
bool QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
{
enum resize resizeEdges = convertToResizeEdges(edges);
resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges);
return true;
}
bool QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice)

View File

@ -76,7 +76,7 @@ public:
~QWaylandWlShellSurface() override;
using QtWayland::wl_shell_surface::resize;
void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
using QtWayland::wl_shell_surface::move;
bool move(QWaylandInputDevice *inputDevice) override;

View File

@ -82,10 +82,11 @@ QtWayland::xdg_surface_v5::resize_edge QWaylandXdgSurfaceV5::convertToResizeEdge
| ((edges & Qt::RightEdge) ? resize_edge_right : 0));
}
void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
bool QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
{
resize_edge resizeEdges = convertToResizeEdges(edges);
resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges);
return true;
}
bool QWaylandXdgSurfaceV5::move(QWaylandInputDevice *inputDevice)

View File

@ -80,7 +80,7 @@ public:
using QtWayland::xdg_surface_v5::resize;
static resize_edge convertToResizeEdges(Qt::Edges edges);
void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
using QtWayland::xdg_surface_v5::move;
bool move(QWaylandInputDevice *inputDevice) override;

View File

@ -237,11 +237,14 @@ QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6()
destroy();
}
void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
bool QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
{
Q_ASSERT(m_toplevel && m_toplevel->isInitialized());
if (!m_toplevel || !m_toplevel->isInitialized())
return false;
auto resizeEdges = Toplevel::convertToResizeEdges(edges);
m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges);
return true;
}
bool QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice)

View File

@ -77,7 +77,7 @@ public:
QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window);
~QWaylandXdgSurfaceV6() override;
void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
bool move(QWaylandInputDevice *inputDevice) override;
bool showWindowMenu(QWaylandInputDevice *seat) override;
void setTitle(const QString &title) override;

View File

@ -266,11 +266,14 @@ QWaylandXdgSurface::~QWaylandXdgSurface()
destroy();
}
void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
bool QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
{
Q_ASSERT(m_toplevel && m_toplevel->isInitialized());
if (!m_toplevel || !m_toplevel->isInitialized())
return false;
auto resizeEdges = Toplevel::convertToResizeEdges(edges);
m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges);
return true;
}
bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice)

View File

@ -80,7 +80,7 @@ public:
QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window);
~QWaylandXdgSurface() override;
void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
bool move(QWaylandInputDevice *inputDevice) override;
bool showWindowMenu(QWaylandInputDevice *seat) override;
void setTitle(const QString &title) override;

View File

@ -73,8 +73,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject
public:
explicit QWaylandShellSurface(QWaylandWindow *window);
~QWaylandShellSurface() override {}
virtual void resize(QWaylandInputDevice * /*inputDevice*/, Qt::Edges /*edges*/) {}
virtual bool resize(QWaylandInputDevice *, Qt::Edges) { return false; }
virtual bool move(QWaylandInputDevice *) { return false; }
virtual bool showWindowMenu(QWaylandInputDevice *seat) { Q_UNUSED(seat); return false; }
virtual void setTitle(const QString & /*title*/) {}

View File

@ -1185,6 +1185,13 @@ void QWaylandWindow::propagateSizeHints()
mShellSurface->propagateSizeHints();
}
bool QWaylandWindow::startSystemResize(Qt::Edges edges)
{
if (auto *seat = display()->lastInputDevice())
return mShellSurface && mShellSurface->resize(seat, edges);
return false;
}
bool QtWaylandClient::QWaylandWindow::startSystemMove()
{
if (auto seat = display()->lastInputDevice())

View File

@ -196,6 +196,7 @@ public:
void propagateSizeHints() override;
void addAttachOffset(const QPoint point);
bool startSystemResize(Qt::Edges edges) override;
bool startSystemMove() override;
void timerEvent(QTimerEvent *event) override;