From aa57e9130b5858800b6a579e26e6475ff0189a75 Mon Sep 17 00:00:00 2001 From: Aki Sakurai Date: Thu, 19 Oct 2023 07:17:28 +0000 Subject: [PATCH] Fix misgenerated QHoverEvent https://doc.qt.io/qt-6/qhoverevent.html#oldPos https://doc.qt.io/qt-6/qhoverevent-obsolete.html#pos oldPos: On QEvent::HoverEnter events, this position will always be QPoint(-1, -1). pos: On QEvent::HoverLeave events, this position will always be QPoint(-1, -1). On the same app, such as Wayland-enabled VS Code, the misgeneration causes the cursor to move to the origin when moving the cursor away from the server side decoration. --- src/pointer_input.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pointer_input.cpp b/src/pointer_input.cpp index 0466f8f711..94482d4961 100644 --- a/src/pointer_input.cpp +++ b/src/pointer_input.cpp @@ -484,7 +484,7 @@ void PointerInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl if (old) { // send leave event to old decoration - QHoverEvent event(QEvent::HoverLeave, QPointF(), QPointF()); + QHoverEvent event(QEvent::HoverLeave, QPointF(-1, -1), QPointF()); QCoreApplication::instance()->sendEvent(old->decoration(), &event); } if (!now) { @@ -493,7 +493,7 @@ void PointerInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl } auto pos = m_pos - now->window()->pos(); - QHoverEvent event(QEvent::HoverEnter, pos, pos); + QHoverEvent event(QEvent::HoverEnter, pos, QPointF(-1, -1)); QCoreApplication::instance()->sendEvent(now->decoration(), &event); now->window()->processDecorationMove(pos, m_pos);