io/key: implement key.Release state

Implement key state for the following platforms:
js, wayland, windows, x11.

Unsupported platforms will continue to function as before, sending
key.Press for all key events.

Signed-off-by: Josiah Niedrauer <josiah@niedrauer.com>
This commit is contained in:
Josiah Niedrauer
2020-10-29 15:46:41 -07:00
committed by Elias Naur
parent ef652f4922
commit 42e568775c
7 changed files with 57 additions and 14 deletions
+15
View File
@@ -46,6 +46,8 @@ type Event struct {
Name string
// Modifiers is the set of active modifiers when the key was pressed.
Modifiers Modifiers
// State is the state of the key when the event was fired.
State State
}
// An EditEvent is generated when text is input.
@@ -53,6 +55,19 @@ type EditEvent struct {
Text string
}
// State is the state of a key during an event.
type State uint8
const (
// Press is the state of a pressed key.
Press State = iota
// Release is the state of a key that has been released.
//
// Note: release events are only implemented on the following platforms:
// Linux, Windows, WebAssembly.
Release
)
// Modifiers
type Modifiers uint32