forked from joejulian/gio
io/input: [API] introduce Source, the interface between a Router and widgets
This change gets rid of the event.Queue interface by replacing it with input.Source values. Source provides the interface to Router necessary to implement interface widgets. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+3
-3
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gioui.org/io/event"
|
||||
"gioui.org/io/input"
|
||||
"gioui.org/layout"
|
||||
"gioui.org/op"
|
||||
"gioui.org/unit"
|
||||
@@ -53,8 +53,8 @@ type FrameEvent struct {
|
||||
// Frame completes the FrameEvent by drawing the graphical operations
|
||||
// from ops into the window.
|
||||
Frame func(frame *op.Ops)
|
||||
// Source supplies the events for event handlers.
|
||||
Source event.Queue
|
||||
// Source is the interface between the interface state and widgets.
|
||||
Source input.Source
|
||||
}
|
||||
|
||||
// Insets is the space taken up by
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ func FuzzIME(f *testing.F) {
|
||||
e.Focus()
|
||||
|
||||
var r input.Router
|
||||
gtx := layout.Context{Ops: new(op.Ops), Source: &r}
|
||||
gtx := layout.Context{Ops: new(op.Ops), Source: r.Source()}
|
||||
// Layout once to register focus.
|
||||
e.Layout(gtx, cache, font.Font{}, unit.Sp(10), op.CallOp{}, op.CallOp{})
|
||||
r.Frame(gtx.Ops)
|
||||
|
||||
+1
-1
@@ -832,7 +832,7 @@ func (w *Window) processEvent(d driver, e event.Event) bool {
|
||||
w.metric = e2.Metric
|
||||
w.hasNextFrame = false
|
||||
e2.Frame = w.update
|
||||
e2.Source = &w.queue
|
||||
e2.Source = w.queue.Source()
|
||||
|
||||
// Prepare the decorations and update the frame insets.
|
||||
wrapper := &w.decorations.Ops
|
||||
|
||||
Reference in New Issue
Block a user