apps/gophers: replace own input router with the window's Queue

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-12 14:02:54 +02:00
parent 46850653ef
commit 343934d3de
2 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ module gioui.org/apps
go 1.12
require (
gioui.org/ui v0.0.0-20190711220556-a22bcfc88c89
gioui.org/ui v0.0.0-20190712115827-46850653ef21
github.com/google/go-github/v24 v24.0.1
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
+3 -6
View File
@@ -52,7 +52,7 @@ type App struct {
cfg app.Config
faces *measure.Faces
inputs *input.Router
inputs input.Queue
fab *ActionButton
@@ -194,7 +194,6 @@ func (a *App) run() error {
case e := <-a.w.Events():
switch e := e.(type) {
case input.Event:
a.inputs.Add(e)
if e, ok := e.(key.ChordEvent); ok {
switch e.Name {
case key.NameEscape:
@@ -245,13 +244,11 @@ func (a *App) run() error {
in := layout.Insets{Top: ui.Dp(16)}
cs = in.Begin(&a.cfg, ops, cs)
txt := fmt.Sprintf("m: %d %s", mallocs, a.w.Timings())
dims := text.Label{Material: theme.text, Face: a.face(fonts.mono, 8), Text: txt}.Layout(ops, cs)
dims := text.Label{Material: theme.text, Face: a.face(fonts.mono, 10), Text: txt}.Layout(ops, cs)
dims = in.End(dims)
al.End(dims)
}
a.w.Draw(ops)
a.inputs.Frame(ops)
a.w.SetTextInput(a.inputs.InputState())
a.faces.Frame()
}
}
@@ -262,7 +259,7 @@ func newApp(w *app.Window) *App {
a := &App{
w: w,
updateUsers: make(chan []*user),
inputs: new(input.Router),
inputs: w.Queue(),
}
a.faces = &measure.Faces{Config: &a.cfg}
a.usersList = &layout.List{