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:
parent
37b79a5968
commit
84209cf53b
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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*/) {}
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user