diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-09-12 15:02:09 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-09-20 09:31:08 +0000 |
commit | 91dbee4c6eb2dcb1c16bf02f2571001726ba6eb1 (patch) | |
tree | 1a9365bf07e6647f157e9168e2b363f44b98f6a4 /src/plugins/shellintegration/xdg-shell | |
parent | 419359e12947992429adc7451a160124187812e8 (diff) |
Decorations: Don't depend on wl_shell
[ChangeLog][QPA plugin] The private window decoration API method,
QWaylandAbstractDecoration::startResize, now takes Qt::Edges argument instead
of a wl_shell_surface_resize enum. This will break window decoration plugins
written for older versions of Qt Wayland.
Change-Id: I4fc9aab949e91efd48a4943f8e116f51dfc373b8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Diffstat (limited to 'src/plugins/shellintegration/xdg-shell')
-rw-r--r-- | src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 21 | ||||
-rw-r--r-- | src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h | 6 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 8b3d07481..07067e120 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -178,6 +178,15 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states) } } +QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResizeEdges(Qt::Edges edges) +{ + return static_cast<enum resize_edge>( + ((edges & Qt::TopEdge) ? resize_edge_top : 0) + | ((edges & Qt::BottomEdge) ? resize_edge_bottom : 0) + | ((edges & Qt::LeftEdge) ? resize_edge_left : 0) + | ((edges & Qt::RightEdge) ? resize_edge_right : 0)); +} + QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner) : xdg_popup(xdgSurface->get_popup(parent->object(), positioner->object())) @@ -245,19 +254,13 @@ QWaylandXdgSurface::~QWaylandXdgSurface() destroy(); } -void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, xdg_toplevel_resize_edge edges) +void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); - m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), edges); + auto resizeEdges = Toplevel::convertToResizeEdges(edges); + m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); } -void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) -{ - auto xdgEdges = reinterpret_cast<enum xdg_toplevel_resize_edge const *>(&edges); - resize(inputDevice, *xdgEdges); -} - - bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) { if (m_toplevel && m_toplevel->isInitialized()) { diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 45d7d4b0e..591df9ddd 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -82,8 +82,7 @@ public: QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window); ~QWaylandXdgSurface() override; - void resize(QWaylandInputDevice *inputDevice, enum xdg_toplevel_resize_edge edges); - void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; + void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; @@ -114,6 +113,9 @@ private: void requestWindowFlags(Qt::WindowFlags flags); void requestWindowStates(Qt::WindowStates states); + + static resize_edge convertToResizeEdges(Qt::Edges edges); + struct { QSize size = {0, 0}; Qt::WindowStates states = Qt::WindowNoState; |