summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorDavid Redondo <qt@david-redondo.de>2021-12-08 11:31:01 +0100
committerDavid Redondo <qt@david-redondo.de>2022-03-08 12:55:18 +0100
commitb6a3a938abd4a7fdb7ea96a38485b53f394fba17 (patch)
tree140aa2551191a93c959d968e3fddae54a6c9fa03 /src/plugins
parentfc9ecef486a5f5657fb0564508a26fbcaf8de6d5 (diff)
downloadqtwayland-b6a3a938abd4a7fdb7ea96a38485b53f394fba17.tar.gz
Allow creating popups from non xdg-shell parents
It's possible to create xdg-popups with a null parent and set a parent via some other protocol. This will be useful for the work of allowing multiple shells in one process. Change-Id: I1fb9035be4b3999ff284bcc5c60eb4142cee1294 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index 2ca6eb9d..55771ec6 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -211,7 +211,7 @@ QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResi
QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent,
QtWayland::xdg_positioner *positioner)
- : xdg_popup(xdgSurface->get_popup(parent->object(), positioner->object()))
+ : xdg_popup(xdgSurface->get_popup(parent ? parent->object() : nullptr, positioner->object()))
, m_xdgSurface(xdgSurface)
, m_parent(parent)
{
@@ -225,7 +225,7 @@ QWaylandXdgSurface::Popup::~Popup()
if (m_grabbing) {
auto *shell = m_xdgSurface->m_shell;
Q_ASSERT(shell->m_topmostGrabbingPopup == this);
- shell->m_topmostGrabbingPopup = m_parent->m_popup;
+ shell->m_topmostGrabbingPopup = m_parent ? m_parent->m_popup : nullptr;
}
}
@@ -421,7 +421,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
{
Q_ASSERT(!m_toplevel && !m_popup);
- auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface());
+ auto parentXdgSurface = qobject_cast<QWaylandXdgSurface *>(parent->shellSurface());
auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner());
// set_popup expects a position relative to the parent
@@ -442,7 +442,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial)
{
- auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface());
+ auto parentXdgSurface = qobject_cast<QWaylandXdgSurface *>(parent->shellSurface());
auto *top = m_shell->m_topmostGrabbingPopup;
if (top && top->m_xdgSurface != parentXdgSurface) {