mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 10:25:37 +00:00
ui: add package input for merged input
To avoid passing a queue type for each kind of input (pointer, key), introduce package input for mapping a handler key to all input events. Future input sources can be added without changes to programs, and as an added bonus, event ordering is preserved across input sources. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+2
-4
@@ -11,9 +11,9 @@ import (
|
||||
|
||||
"gioui.org/ui"
|
||||
"gioui.org/ui/app/internal/gpu"
|
||||
"gioui.org/ui/input"
|
||||
"gioui.org/ui/internal/ops"
|
||||
"gioui.org/ui/key"
|
||||
"gioui.org/ui/pointer"
|
||||
)
|
||||
|
||||
type WindowOptions struct {
|
||||
@@ -238,9 +238,7 @@ func (w *Window) event(e Event) {
|
||||
needAck := false
|
||||
needRedraw := false
|
||||
switch e := e.(type) {
|
||||
case pointer.Event:
|
||||
needRedraw = true
|
||||
case key.Event:
|
||||
case input.Event:
|
||||
needRedraw = true
|
||||
case *Command:
|
||||
needAck = true
|
||||
|
||||
Reference in New Issue
Block a user