summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2024-04-22 11:30:17 +0200
committerLiang Qi <liang.qi@qt.io>2024-04-22 15:44:39 +0200
commitae380d3430276b7bdb4d89570c2d8ed4976598b3 (patch)
tree13673131d4af5705d1859b138d9d50caab867974
parent61bfeaed5976a16635ec86e02167cfca6ad751f7 (diff)
client: Synthesize enter/leave event for popup in xdg-shell - 2
This amends 73d35d3117722cef8e94f0d2036c56ad0a5ddae9. We can't depend on QGuiApplication::topLevelAt(). For security reason, Wayland doesn't provide global position for top level windows in most cases. We just synthesize enter/leave event for popup between it and the parent. Task-number: QTBUG-100148 Task-number: QTBUG-113404 Pick-to: 6.7 6.5 6.2 5.15 Change-Id: I9de1d413cdbc43486c1a110df4517750983e4fda Reviewed-by: David Edmundson <davidedmundson@kde.org>
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index eec89eff7..d65d4e722 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -252,7 +252,9 @@ QWaylandXdgSurface::Popup::~Popup()
leave = m_xdgSurface->window()->window();
QWindowSystemInterface::handleLeaveEvent(leave);
- if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos())) {
+ QWindow *enter = nullptr;
+ if (m_parentXdgSurface && m_parentXdgSurface->window()) {
+ enter = m_parentXdgSurface->window()->window();
const auto pos = m_xdgSurface->window()->display()->waylandCursor()->pos();
QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos);
}
@@ -595,11 +597,7 @@ void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevic
// 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;