In the laptop layout, Orca uses capslock as the key for forming navigation shortcuts. It thus has to disable the behavior of capslock inside xkb. It however reacts to a double-press on the orca key to trigger the capslock behavior through XkbLockModifiers. To determine whether it should enable or disable the capslock behavior, Orca looks at the capslock modifier of the capslock key events (since other applications might be tampering with the state of the capslock modifier).
However, qtbase does not set the capslock modifier state in its key events :/
More precisely, in QSpiApplicationAdaptor::eventFilter, the ATSPI_MODIFIER_SHIFTLOCK flag (actually capslock modifier) only set when the capslock key is kept pressed, not when the capslock modifier is enabled. Indeed, while the state of the other modifiers show up in keyEvent->modifiers, there is no such thing in Qt for the capslock modifier (enum KeyboardModifier does not contain capslock, only shift, control, alt, meta).
This means that when pressing double-capslock in a Qt application, Orca enables capslock, and when pressing double-capslock again, Orca still thinks that capslock is not enabled (since the capslock key events don't have the capslock modifier flag set), and enables capslock again instead of disabling it.
Fixing this in Qt would comprise:
- adding CapslockModifier to enum KeyboardModifier
- adding the test for XCB_MOD_MASK_LOCK to enable CapslockModifier appropriately in QXcbKeyboard::translateModifiers.
I can work on a patch, but would this approach be considered?