diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2021-09-07 15:29:31 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2021-09-23 03:20:08 +0000 |
commit | 8a8be2d638ac6e54cab359e6ac13f73f53787481 (patch) | |
tree | 5ea566aeba308e343bb993131fb058481a4f7910 /src/xml/qt_cmdline.cmake | |
parent | 8f13af5d7b9b659208a8a93e6581d30b434dae1f (diff) |
macOS: Change NSTrackingArea to use NSTrackingActiveAlways
The current implementation configured NSTrackingArea to be active
while the application was active (NSTrackingActiveInActiveApp).
But because of a bug in AppKit, the tracking area would sometimes
stop being updated, with the result that no mouse events was being
sent from AppKit. One way to trigger this bug would be to
deactivate the app using cmd+tab (fast enough so that the task
switcher is not showing), and reactivate it again using a
mouse click.
To work around this issue, this patch will instead configure
the tracking area to always listen for tracking events, even when
the application is inactive (NSTrackingActiveAlways). By doing so,
we bypass the apparently broken behavior in AppKit related to
activation. The downside is that we then also get tracking events
while the application is inactive, which is against how Qt should
work. So we therefore need to now check if the application is active
before we forward any tracking events to QWSI.
With NSTrackingActiveAlways we no longer get enter/leave events
from AppKit when the application is activated/deactivated and the
mouse stays on top of the application, so we now also need to handle
this explicitly from the application delegate. Since we already need
to keep track of which QWindow is under the mouse to be able to send
out enter/leave from mouse moves, we use the same variable
(s_windowUnderMouse) for this purpose as well.
Because of QTBUG-35109, there was already a code path in QCocoaWindow
that sent out an enter event when a window became key. This is no
longer needed now that we send out enter/leave when the application is
activated/deactivated. It's also questionable if sending an enter
event based on a window's key status is correct, since we in Qt should
also send out enter events for inactive windows. So we remove this code
path since it interferes with (both the old and) the new implementation.
Fixes: QTBUG-36926
Task-number: QTBUG-94447
Change-Id: I5c1105bc3102925c9c65964b4a7d1e02efd01735
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/xml/qt_cmdline.cmake')
0 files changed, 0 insertions, 0 deletions