From 75891f024c008430b797386416e29e37f3b11949 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 18 Jul 2019 18:46:34 +0200 Subject: [PATCH] apps/gophers: update to rename Window.Invalidate method Signed-off-by: Elias Naur --- apps/go.mod | 2 +- apps/gophers/main.go | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/go.mod b/apps/go.mod index d6a09af9..8b901d26 100644 --- a/apps/go.mod +++ b/apps/go.mod @@ -3,7 +3,7 @@ module gioui.org/apps go 1.12 require ( - gioui.org/ui v0.0.0-20190718135811-84fb7279eb3b + gioui.org/ui v0.0.0-20190718164546-d9d8df989d4c 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 diff --git a/apps/gophers/main.go b/apps/gophers/main.go index 578449ee..5fa806fb 100644 --- a/apps/gophers/main.go +++ b/apps/gophers/main.go @@ -78,7 +78,7 @@ type App struct { type userPage struct { config ui.Config faces *measure.Faces - redraw redrawer + invalidate func() user *user commitsList *layout.List commits []*github.Commit @@ -101,8 +101,6 @@ type icon struct { imgSize int } -type redrawer func() - type ActionButton struct { config ui.Config inputs input.Queue @@ -189,7 +187,7 @@ func (a *App) run() error { case users := <-a.updateUsers: a.users = users a.userClicks = make([]gesture.Click, len(users)) - a.w.Redraw() + a.w.Invalidate() case e := <-a.w.Events(): switch e := e.(type) { case key.ChordEvent: @@ -199,7 +197,7 @@ func (a *App) run() error { case 'P': if e.Modifiers.Contain(key.ModCommand) { a.profiling = !a.profiling - a.w.Redraw() + a.w.Invalidate() } } case app.DestroyEvent: @@ -224,7 +222,7 @@ func (a *App) run() error { if a.selectedUser != nil { a.selectedUser = nil e.Cancel = true - a.w.Redraw() + a.w.Invalidate() } } case app.DrawEvent: @@ -422,7 +420,7 @@ func (a *App) newUserPage(user *user) *userPage { up := &userPage{ config: &a.cfg, faces: a.faces, - redraw: a.w.Redraw, + invalidate: a.w.Invalidate, user: user, commitsList: &layout.List{Config: &a.cfg, Inputs: a.inputs, Axis: layout.Vertical}, commitsResult: make(chan []*github.Commit, 1), @@ -491,7 +489,7 @@ func (up *userPage) fetchCommits(ctx context.Context) { } } up.commitsResult <- commits - up.redraw() + up.invalidate() }() }