nvda
71bae80b - Pass the injected flag to the decide_handleRawKey extension point (#20748)

Commit
11 days ago
Pass the injected flag to the decide_handleRawKey extension point (#20748) Closes #20714 Summary of the issue: NVDA's low level keyboard hook knows whether a key event was injected. However, the extension point that lets code veto a raw key event only passes vkCode, scanCode, extended and pressed to its handlers. injected is missing. Description of user facing changes: None. Description of developer facing changes: Handlers of inputCore.decide_handleRawKey now also receive injected. It is True when the key event was injected by software rather than generated by the keyboard. The two hook callbacks in keyboardHandler, internal_keyDownEvent and internal_keyUpEvent, gained type annotations and docstrings. Description of development approach: The low level keyboard hook already passes the injected flag to keyboardHandler.internal_keyDownEvent and internal_keyUpEvent. Both functions now forward it to decide_handleRawKey.decide as the injected keyword argument. Extension point handlers only receive the keyword arguments they declare, so existing handlers keep working unchanged. A handler that must also run on older NVDA versions can declare the parameter with a default, such as injected: bool | None = None.
Author
Parents
Loading