diff options
author | Ilya Fedin <fedin-ilja2010@ya.ru> | 2023-12-03 19:12:03 +0400 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-12-04 11:59:28 +0000 |
commit | a86998052176e0c013540635ea51033f16e33e6f (patch) | |
tree | 155bb14f385d746dd1ff139b4649ae3d6dd27c8e /src | |
parent | e8673e9cc31a9b015b3f30e2581605bb4624c9ac (diff) |
Client: Fix enter event cursor position with xdg-popup and QHighDpiScaling
QWindowSystemInterface::handleEnterEvent accepts device-dependent
position while QCursor::pos provides device-independent position.
Use QWaylandCursor::pos instead.
Pick-to: 6.5 6.2 5.15
Change-Id: I70d2997610f7a34c6763bd4f10f20a65c3debdbe
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit 8e57e8b51b2b701c5520f37b7d78de5b3c488500)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index be6fad15c..5c91c69e1 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -10,6 +10,7 @@ #include <QtWaylandClient/private/qwaylandwindow_p.h> #include <QtWaylandClient/private/qwaylandinputdevice_p.h> #include <QtWaylandClient/private/qwaylandscreen_p.h> +#include <QtWaylandClient/private/qwaylandcursor_p.h> #include <QtWaylandClient/private/qwaylandabstractdecoration_p.h> #include <QtGui/QGuiApplication> @@ -229,8 +230,10 @@ QWaylandXdgSurface::Popup::~Popup() leave = m_xdgSurface->window()->window(); QWindowSystemInterface::handleLeaveEvent(leave); - if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos())) - QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(QCursor::pos()), QCursor::pos()); + if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos())) { + const auto pos = m_xdgSurface->window()->display()->waylandCursor()->pos(); + QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos); + } } } @@ -582,8 +585,10 @@ void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevic 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()); + if (enter) { + const auto pos = m_popup->m_xdgSurface->window()->display()->waylandCursor()->pos(); + QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos); + } } void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) |