app,io/key,io/system: [API] replace system.CommandEvent with key.Event

It's much simpler to map the Android back button to a key.Event and
let the usual key filtering determine whether to block its default
behaviour.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-04-14 17:45:04 +02:00
parent ad7c1eb78d
commit 6c76fa6dec
5 changed files with 20 additions and 37 deletions
+3 -21
View File
@@ -54,20 +54,9 @@ type StageEvent struct {
Stage Stage
}
// CommandEvent is a system event. Unlike most other events, CommandEvent is
// delivered as a pointer to allow Cancel to suppress it.
type CommandEvent struct {
Type CommandType
// Cancel suppress the default action of the command.
Cancel bool
}
// Stage of a Window.
type Stage uint8
// CommandType is the type of a CommandEvent.
type CommandType uint8
const (
// StagePaused is the Stage for inactive Windows.
// Inactive Windows don't receive FrameEvents.
@@ -76,12 +65,6 @@ const (
StageRunning
)
const (
// CommandBack is the command for a back action
// such as the Android back button.
CommandBack CommandType = iota
)
func (l Stage) String() string {
switch l {
case StagePaused:
@@ -93,7 +76,6 @@ func (l Stage) String() string {
}
}
func (FrameEvent) ImplementsEvent() {}
func (StageEvent) ImplementsEvent() {}
func (*CommandEvent) ImplementsEvent() {}
func (DestroyEvent) ImplementsEvent() {}
func (FrameEvent) ImplementsEvent() {}
func (StageEvent) ImplementsEvent() {}
func (DestroyEvent) ImplementsEvent() {}