mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
committed by
Elias Naur
parent
ef652f4922
commit
42e568775c
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user