summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index ac5d50a13..e11745505 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -220,6 +220,16 @@ QWaylandXdgSurface::Popup::~Popup()
auto *shell = m_xdgSurface->m_shell;
Q_ASSERT(shell->m_topmostGrabbingPopup == this);
shell->m_topmostGrabbingPopup = m_parent->m_popup;
+ m_grabbing = false;
+
+ // Synthesize Qt enter/leave events for popup
+ QWindow *leave = nullptr;
+ if (m_xdgSurface && m_xdgSurface->window())
+ leave = m_xdgSurface->window()->window();
+ QWindowSystemInterface::handleLeaveEvent(leave);
+
+ if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos()))
+ QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(QCursor::pos()), QCursor::pos());
}
}
@@ -441,6 +451,23 @@ void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevic
}
setPopup(parent);
m_popup->grab(device, serial);
+
+ // Synthesize Qt enter/leave events for popup
+ if (!parent)
+ return;
+ QWindow *current = QGuiApplication::topLevelAt(QCursor::pos());
+ QWindow *leave = parent->window();
+ if (current != leave)
+ return;
+
+ QWindowSystemInterface::handleLeaveEvent(leave);
+
+ QWindow *enter = nullptr;
+ if (m_popup && m_popup->m_xdgSurface && m_popup->m_xdgSurface->window())
+ enter = m_popup->m_xdgSurface->window()->window();
+
+ if (enter)
+ QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(QCursor::pos()), QCursor::pos());
}
void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)