From 9135dec42de1880bd8b2972ba01f97a219cb0093 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 14 Jan 2019 09:38:51 +0100 Subject: Client: Implement QPlatformWindow::startSystemResize Task-number: QTBUG-73011 Change-Id: Ife0d9949b4d4dd7e6f16d3de88d0cb4bf4991e09 Reviewed-by: Pier Luigi Fiorini Reviewed-by: David Edmundson --- src/client/qwaylandshellsurface_p.h | 3 +-- src/client/qwaylandwindow.cpp | 7 +++++++ src/client/qwaylandwindow_p.h | 1 + src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp | 3 ++- src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h | 2 +- src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 3 ++- src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h | 2 +- src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 7 +++++-- src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h | 2 +- src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 7 +++++-- src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h | 2 +- 11 files changed, 27 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h index f5f202d08..989cdb81b 100644 --- a/src/client/qwaylandshellsurface_p.h +++ b/src/client/qwaylandshellsurface_p.h @@ -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*/) {} diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 7802aca66..c8a01dc2e 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -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()) diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index 8a22bacca..823e4a970 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -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; diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 48e14c753..245fec196 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -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) diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index 324c10aac..ca7ba602c 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -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; diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index e8bff9193..770fad7e8 100644 --- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -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) diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h index feebee7f4..bf221079e 100644 --- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h +++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h @@ -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; diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index dc3cfdbfa..c137b308b 100644 --- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -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) diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index f77a4d4ba..757b982b9 100644 --- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -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; diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index bd1f5a210..a8e662679 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -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) diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 8f8682a47..0c98be35c 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -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; -- cgit v1.2.3