Position grabbing popups correctly when started from hover events


If there is no known lastInputDevice, child popups will be randomly
positioned. This can happen when a popup is triggered by a hover event.
The obvious fix is to call setLastInputDevice from pointer_enter().
However, Weston (and probably other compositors) do not accept enter
events as valid grab serials. Calling setLastInputDevice from every pointer_enter would therefore completely disable menu popup on mouse-over for those compositors.
The solution is to only call setLastInputDevice when we have not seen one before. This means that the user may have to click once to get hover popups to work. This should be an acceptable price to pay to avoid menus appearing at random positions.

Fixes: QTBUG-128937
Change-Id: I446abb2f4bed65cb4c46ec89d08025cd6cd8e5f3
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
commitd49fab406e847de4b6c11b68eb7ed83b24d2a004
parentcc1602be7c2eca01f139e63c4e4991a19e23285f
authorPaul Olav Tvete <paul.tvete@qt.io>
committerPaul Olav Tvete <paul.tvete@qt.io>
commit timeThu, 7 Nov 2024 09:30:23 +0000