5afb04d79b
On macOS, users can right-click into an inactive application to open a context menu without activating the application. Qt handles a number of events to close open popups (window deactivating or a mouse press outside the popup), but none of those will get called when the application is already inactive. So the popup might stay open (and on top of the window stack) when the user clicks into other applications, or activates another window. To fix this we need to watch for events outside of the Qt application on which we need to close the popup: when the user presses a mouse button, or activates another application using Cmd-Tab. But we don't want to monitor for key events, as that requires user permission. Use a global event monitor to watch for mouse presses, and an notification observer to watch for application activations, and respond by closing all popups (and removing the monitor and observer again). Use the monitor as well to watch for mouse moves, and pass only those events through the Qt event system so that mouse tracking in the menu works even if the application is inactive. This change brings back a version of the global event monitor we had in Qt 5.15. However, a press into our own menu will trigger the activation observer after the application became active, which would now close the menu. We don't want that, so we also need to remove the observer when the application becomes active (which makes sense anyway, as we will get regular events from then on). Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-105474 Change-Id: I18573fcda09a46c27730bd670a795f4d467aab01 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
LICENSES | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
conanfile.py | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
qt_cmdline.cmake | ||
sync.profile |