- 
                Notifications
    
You must be signed in to change notification settings  - Fork 725
 
Closed
Description
The keyboard handling code has gotten super crufty over time.
We have:
KeyEvent- Originally designed to be passed to functions (before .NETevent EventHandlerstuff) as an abstraction above the driversKeyEventEventArgs- Recently (clumsily) renamed to match modern patterns. Basically just holds aKeyEventProcessKey, etc... = Don't match our event pattern (should be namedOnKeyPressedetc... Takes aKeyEvent- There is no 
KeyPressedevent. There should be. It will useKeyEventEventArgsmakingProcessKey/OnKeyPressedweird for taking aKeyEvent 
This all results in a lot of confusing and ugly code that is ripe for hard to find bugs. E.g.
I want to simplify this. I did a prototype and it worked well, but I screwed up and lost the work.
Plan:
- There will be one class, 'KeyEventArgs
defined in./Input/Keyboard.cs. It will mergeKeyEventandKeyEventEventArgs.KeyandKeyModifiersdefns will move toKeyboard.cstoo (Event.cswill be renamedMouse.cs`) - The 
RespondermethodsProcessKey,ProcessHotKeyandProcessColdKeywill- Be renamed to 
OnKeyPressed,OnHotKeyPressed, andOnColdKeyPressedand the signature will bebool OnKeyPresssed(KeyEventArgs args) - Be accompanied by new events (
KeyPressed,KeyDown,KeyUp). There is no need to add Hot/Cold key events, because we want people to use theCommandframework for that anyway. 
 - Be renamed to 
 - All library code will be updated as needed. Where it makes sense, events will be used instead of overriding the On methods. In some cases I may move code to use Command to reduce code.
 - All Scenario code will be updated as well.
 
This will be a massive PR in terms of files touched.
We will also want to do the same thing to Mouse handling.
Thoughts?
Metadata
Metadata
Assignees
Labels
No labels