mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
apps/gophers: replace own input router with the window's Queue
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ module gioui.org/apps
|
|||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require (
|
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
|
github.com/google/go-github/v24 v24.0.1
|
||||||
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
|
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
|
||||||
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
|
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ type App struct {
|
|||||||
cfg app.Config
|
cfg app.Config
|
||||||
faces *measure.Faces
|
faces *measure.Faces
|
||||||
|
|
||||||
inputs *input.Router
|
inputs input.Queue
|
||||||
|
|
||||||
fab *ActionButton
|
fab *ActionButton
|
||||||
|
|
||||||
@@ -194,7 +194,6 @@ func (a *App) run() error {
|
|||||||
case e := <-a.w.Events():
|
case e := <-a.w.Events():
|
||||||
switch e := e.(type) {
|
switch e := e.(type) {
|
||||||
case input.Event:
|
case input.Event:
|
||||||
a.inputs.Add(e)
|
|
||||||
if e, ok := e.(key.ChordEvent); ok {
|
if e, ok := e.(key.ChordEvent); ok {
|
||||||
switch e.Name {
|
switch e.Name {
|
||||||
case key.NameEscape:
|
case key.NameEscape:
|
||||||
@@ -245,13 +244,11 @@ func (a *App) run() error {
|
|||||||
in := layout.Insets{Top: ui.Dp(16)}
|
in := layout.Insets{Top: ui.Dp(16)}
|
||||||
cs = in.Begin(&a.cfg, ops, cs)
|
cs = in.Begin(&a.cfg, ops, cs)
|
||||||
txt := fmt.Sprintf("m: %d %s", mallocs, a.w.Timings())
|
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)
|
dims = in.End(dims)
|
||||||
al.End(dims)
|
al.End(dims)
|
||||||
}
|
}
|
||||||
a.w.Draw(ops)
|
a.w.Draw(ops)
|
||||||
a.inputs.Frame(ops)
|
|
||||||
a.w.SetTextInput(a.inputs.InputState())
|
|
||||||
a.faces.Frame()
|
a.faces.Frame()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -262,7 +259,7 @@ func newApp(w *app.Window) *App {
|
|||||||
a := &App{
|
a := &App{
|
||||||
w: w,
|
w: w,
|
||||||
updateUsers: make(chan []*user),
|
updateUsers: make(chan []*user),
|
||||||
inputs: new(input.Router),
|
inputs: w.Queue(),
|
||||||
}
|
}
|
||||||
a.faces = &measure.Faces{Config: &a.cfg}
|
a.faces = &measure.Faces{Config: &a.cfg}
|
||||||
a.usersList = &layout.List{
|
a.usersList = &layout.List{
|
||||||
|
|||||||
Reference in New Issue
Block a user