summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-01-14 09:38:51 +0100
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2020-02-05 08:50:56 +0100
commit9135dec42de1880bd8b2972ba01f97a219cb0093 (patch)
tree0751b7717ee66ad57020a5d9d8cedc34f6fcadb0
parent705ae10b204c5a5c47fe75a6ab324d5ed4cd173e (diff)
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>
-rw-r--r--src/client/qwaylandshellsurface_p.h3
-rw-r--r--src/client/qwaylandwindow.cpp7
-rw-r--r--src/client/qwaylandwindow_p.h1
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp3
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h2
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp3
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h2
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp7
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h2
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp7
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h2
11 files changed, 27 insertions, 12 deletions
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;