This adds sticky locking to Lock type keys.
Before: click to switch, click to type, and get switched back automatically.
After: click to switch, click again to hold, click to type, no switching back automatically.
WIP: No UI indication that anything is locked.
As a bonus, I felt a huge need to make this unit-testable, so it has been decoupled from press-handling and side-effect-applying code. Not perfectly, but net beneficially.