diff options
author | Liang Qi <liang.qi@qt.io> | 2022-03-11 09:17:25 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2022-04-04 20:44:00 +0200 |
commit | bc11b00d0d408fcc3cd70c1875b75b1077542ead (patch) | |
tree | a0dbee3f2fe99cf0fcd3c24b1e06450ef5f4b5de | |
parent | 3dadcd5b4b3c21b785dd10c67904c48ce03a9023 (diff) | |
download | qtwayland-6.2.tar.gz |
client: Synthesize enter/leave event for popup in xdg-shell6.2
Fixes: QTBUG-100148
Change-Id: I45e3156d7942cff9968674c0b253d15be7235921
Reviewed-by: Tang Haixiang <tanghaixiang@uniontech.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 73d35d3117722cef8e94f0d2036c56ad0a5ddae9)
Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r-- | src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 27 |
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 66aa3d43..dbfdee77 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -232,6 +232,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()); } } @@ -466,6 +476,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) |