mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
app/internal/window: implement key.Press and key.Release on macOS
Update key.State documentation and add State.String while here. Also update Event.String to include State. Signed-off-by: Raffaele Sena <raff367@gmail.com>
This commit is contained in:
committed by
Elias Naur
parent
e195309d55
commit
8a3ff4abcb
+14
-2
@@ -10,6 +10,7 @@ events.
|
||||
package key
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"gioui.org/internal/opconst"
|
||||
@@ -64,7 +65,7 @@ const (
|
||||
// Release is the state of a key that has been released.
|
||||
//
|
||||
// Note: release events are only implemented on the following platforms:
|
||||
// Linux, Windows, WebAssembly.
|
||||
// macOS, Linux, Windows, WebAssembly.
|
||||
Release
|
||||
)
|
||||
|
||||
@@ -129,7 +130,7 @@ func (Event) ImplementsEvent() {}
|
||||
func (FocusEvent) ImplementsEvent() {}
|
||||
|
||||
func (e Event) String() string {
|
||||
return "{" + string(e.Name) + " " + e.Modifiers.String() + "}"
|
||||
return fmt.Sprintf("%v %v %v}", e.Name, e.Modifiers, e.State)
|
||||
}
|
||||
|
||||
func (m Modifiers) String() string {
|
||||
@@ -151,3 +152,14 @@ func (m Modifiers) String() string {
|
||||
}
|
||||
return strings.Join(strs, "|")
|
||||
}
|
||||
|
||||
func (s State) String() string {
|
||||
switch s {
|
||||
case Press:
|
||||
return "Press"
|
||||
case Release:
|
||||
return "Release"
|
||||
default:
|
||||
panic("invalid State")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user