From 682f7c4b78ce130d621d70b770062d76cd13fa2a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 12 Apr 2024 13:29:56 +0200 Subject: [PATCH] client: implement QWaylandScreen::topLevelAt() For security reason, Wayland doesn't provide global position for top level windows in most cases. Task-number: QTBUG-113404 Pick-to: 6.7 6.5 6.2 5.15 Change-Id: I2cd11b641fba6582cf96cfbea16f5e598a473db5 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 10 ++++++++++ src/plugins/platforms/wayland/qwaylandscreen_p.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 3faef3f255d..d51e8c6a0b6 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -170,6 +170,16 @@ QList QWaylandScreen::virtualSiblings() const return list; } +QWindow *QWaylandScreen::topLevelAt(const QPoint & pos) const +{ + if (QWaylandWindow::fixedToplevelPositions) { + Q_UNUSED(pos); + return nullptr; + } + + return QPlatformScreen::topLevelAt(pos); +} + Qt::ScreenOrientation QWaylandScreen::orientation() const { return m_orientation; diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index ff3d23217c7..ce3df3099ed 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -63,6 +63,8 @@ public: QDpi logicalDpi() const override; QList virtualSiblings() const override; + QWindow *topLevelAt(const QPoint &point) const override; + Qt::ScreenOrientation orientation() const override; int scale() const; qreal devicePixelRatio() const override;