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.
This commit is contained in:
Aki Sakurai 2023-10-19 07:17:28 +00:00 committed by Vlad Zahorodnii
parent e398289287
commit aa57e9130b

View file

@ -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);