Repeated keys are detected properly

The repeated bool was removed and instead key release events are
*only* sent when the key is actually let go. If an element wants to
listen to repeat presses, it can just listen to press events.
This commit is contained in:
2023-01-20 17:40:28 -05:00
parent 2f53c942ac
commit 72f604e819
7 changed files with 56 additions and 64 deletions

View File

@@ -86,12 +86,12 @@ type Selectable interface {
type KeyboardTarget interface {
Element
// HandleKeyDown is called when a key is pressed down while this element
// has keyboard focus. It is important to note that not every key down
// event is guaranteed to be paired with exactly one key up event. This
// is the reason a list of modifier keys held down at the time of the
// key press is given.
HandleKeyDown (key Key, modifiers Modifiers, repeated bool)
// HandleKeyDown is called when a key is pressed down or repeated while
// this element has keyboard focus. It is important to note that not
// every key down event is guaranteed to be paired with exactly one key
// up event. This is the reason a list of modifier keys held down at the
// time of the key press is given.
HandleKeyDown (key Key, modifiers Modifiers)
// HandleKeyUp is called when a key is released while this element has
// keyboard focus.