Add new extension points for keyboard input and speech pause (#17428)
This commit introduces two new extension points:
inputCore.decide_handleRawKey
Called before any NVDA processing of raw keyboard events
Allows add-ons to intercept and optionally block keyboard events
Provides full context: vkCode, scanCode, extended flag, and press/release state
Implemented in both keyDown and keyUp event handlers
Returns True to allow normal processing, False to block the key
speech.extensions.speechPaused
Notifies when speech is paused or resumed
Provides boolean 'switch' parameter (True=paused, False=resumed)
Added corresponding unit tests to verify functionality
Integrated into existing pauseSpeech() function
Technical Details:
Added documentation for both extension points in developerGuide.md
Updated speech/init.py to expose the new speechPaused extension point
Added test case in test_speech.py to verify extension point behavior
Maintains backwards compatibility with existing extensions
These additions enable add-ons to:
Implement advanced keyboard interception/modification
React to speech pause state changes
Link to issue number:
N/A - New feature addition for extensibility
Summary of the issue:
NVDA needed additional extension points to allow add-ons to:
Intercept and control raw keyboard events before NVDA processing
Monitor and react to speech pause state changes
Description of user facing changes
No direct user-facing changes
Enables add-on developers to create more sophisticated keyboard handling and speech feedback features
All changes are API-level additions that maintain backwards compatibility
Description of development approach
Raw Keyboard Extension Point:
Added decide_handleRawKey extension point in inputCore.py
Integrated into both keyDown and keyUp event handlers in keyboardHandler.py
Full keyboard event context provided (vkCode, scanCode, extended, pressed)
Boolean return value controls event propagation
Speech Pause Extension Point:
Added speechPaused extension point in speech/extensions.py
Integrated into existing pauseSpeech() function
Provides pause state through boolean parameter
Documentation:
Added entries in developerGuide.md
Updated relevant module documentation
Added changelog entry