diff options
author | Liang Qi <liang.qi@qt.io> | 2018-06-28 18:24:20 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-06-28 20:56:59 +0200 |
commit | efbeace6ffa14de0f7a1ec8b8b9653056612d5f8 (patch) | |
tree | eb2b2fccc7aa1422ed7be48e97c6fa90b057680a /src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | |
parent | 4d9e127d3c3171bd796c5d6fc7c1c2f70101ad34 (diff) | |
parent | 56e01f9e3372446d20f0bb70bed0b88348f2a74b (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/client/qwaylandxdgsurface.cpp
src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp
src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h
Done-with: Johan Klokkhammer Helsing <johan.helsing@qt.io>
Change-Id: Ia39be6254a95af1c4efa831358cc06a697da3423
Diffstat (limited to 'src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp')
-rw-r--r-- | src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index a8bfaac69..986deceb1 100644 --- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -152,6 +152,7 @@ QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdg QtWayland::zxdg_positioner_v6 *positioner) : zxdg_popup_v6(xdgSurface->get_popup(parent->object(), positioner->object())) , m_xdgSurface(xdgSurface) + , m_parent(parent) { } @@ -159,6 +160,19 @@ QWaylandXdgSurfaceV6::Popup::~Popup() { if (isInitialized()) destroy(); + + if (m_grabbing) { + auto *shell = m_xdgSurface->m_shell; + Q_ASSERT(shell->m_topmostPopup == this); + shell->m_topmostPopup = m_parent->m_popup; + } +} + +void QWaylandXdgSurfaceV6::Popup::grab(QWaylandInputDevice *seat, uint serial) +{ + m_xdgSurface->m_shell->m_topmostPopup = this; + zxdg_popup_v6::grab(seat->wl_seat(), serial); + m_grabbing = true; } void QWaylandXdgSurfaceV6::Popup::zxdg_popup_v6_popup_done() @@ -192,8 +206,10 @@ QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() { if (m_toplevel) zxdg_toplevel_v6_destroy(m_toplevel->object()); - if (m_popup) - zxdg_popup_v6_destroy(m_popup->object()); + if (m_popup) { + delete m_popup; + m_popup = nullptr; + } destroy(); } @@ -277,6 +293,14 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice Q_ASSERT(!m_toplevel && !m_popup); auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(parent->shellSurface()); + + auto *top = m_shell->m_topmostPopup; + if (grab && top && top->m_xdgSurface != parentXdgSurface) { + qCWarning(lcQpaWayland) << "setPopup called for a surface that was not the topmost popup, positions might be off."; + parentXdgSurface = top->m_xdgSurface; + parent = top->m_xdgSurface->m_window; + } + auto positioner = new QtWayland::zxdg_positioner_v6(m_shell->create_positioner()); // set_popup expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute @@ -292,9 +316,8 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; - if (grab) { - m_popup->grab(device->wl_seat(), serial); - } + if (grab) + m_popup->grab(device, serial); } void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) |