Description
I'm using Qt 5.12.8, on Ubuntu 20.04 under X.
Using the HotkeyTest app, if I register a hotkey, e.g. a
I understand that that key will be consumed, but it seems that all other keys are consumed as well between when a
is pressed and when it's released.
Repro steps:
- Bind
a
as Hotkey 1 in the test app, activate the hotkey - In another windows, hold a, then type
sdf
- Release
a
, then typeg
.
Observed behaviour:
QHotkey::activated
is fired.QHotkey::released
is fired.g
is entered into the underlying application.
Can this be avoided? This seems quite intrusive for e.g. games where a user might want to hold a push to talk button and keep entering other keys at the same time.
I've done a bit of investigation and
- If I immediately
return false
inQHotkeyPrivateX11::nativeEventFilter
, the behaviour doesn't change. Returning false there looks correct to avoid eating the key per Qt docs: https://doc.qt.io/qt-5/qabstractnativeeventfilter.html#nativeEventFilterIn your reimplementation of this function, if you want to filter the message out, i.e. stop it being handled further, return true; otherwise return false.
XGrabKey
's registration usesTrue
, which from docsSpecifies a Boolean value that indicates whether the keyboard events are to be reported as usual.
So I don't understand why the keys are being masked at all. Based on docs it seems like not even the shortcut key should be masked? But I'm more interested if still getting the non-shortcut keys while the shortcut is held.