diff --git a/cmd/tailscale/main.go b/cmd/tailscale/main.go index 56e0fbf..47f80e4 100644 --- a/cmd/tailscale/main.go +++ b/cmd/tailscale/main.go @@ -586,8 +586,10 @@ func (a *App) runUI() error { } } case system.FrameEvent: + ins := e.Insets + e.Insets = system.Insets{} gtx := layout.NewContext(&ops, e) - events := ui.layout(gtx, e.Insets, state) + events := ui.layout(gtx, ins, state) e.Frame(gtx.Ops) a.processUIEvents(w, events, activity, state) } diff --git a/cmd/tailscale/ui.go b/cmd/tailscale/ui.go index b0a7d99..719712c 100644 --- a/cmd/tailscale/ui.go +++ b/cmd/tailscale/ui.go @@ -322,7 +322,7 @@ type Dismiss struct { } func (d *Dismiss) Add(gtx layout.Context) { - defer op.Push(gtx.Ops).Pop() + defer op.Save(gtx.Ops).Load() pointer.Rect(image.Rectangle{Max: gtx.Constraints.Min}).Add(gtx.Ops) pointer.InputOp{Tag: d, Types: pointer.Press}.Add(gtx.Ops) } @@ -824,41 +824,41 @@ func drawLogo(ops *op.Ops, size int) { tx := op.Offset(f32.Pt(off, 0)) ty := op.Offset(f32.Pt(0, off)) - st := op.Push(ops) - defer st.Pop() + st := op.Save(ops) + defer st.Load() // First row of discs. - row := op.Push(ops) + row := op.Save(ops) drawDisc(ops, discDia, rgb(0x54514d)) tx.Add(ops) drawDisc(ops, discDia, rgb(0x54514d)) tx.Add(ops) drawDisc(ops, discDia, rgb(0x54514d)) - row.Pop() + row.Load() ty.Add(ops) // Second row. - row = op.Push(ops) + row = op.Save(ops) drawDisc(ops, discDia, rgb(0xfffdfa)) tx.Add(ops) drawDisc(ops, discDia, rgb(0xfffdfa)) tx.Add(ops) drawDisc(ops, discDia, rgb(0xfffdfa)) - row.Pop() + row.Load() ty.Add(ops) // Third row. - row = op.Push(ops) + row = op.Save(ops) drawDisc(ops, discDia, rgb(0x54514d)) tx.Add(ops) drawDisc(ops, discDia, rgb(0xfffdfa)) tx.Add(ops) drawDisc(ops, discDia, rgb(0x54514d)) - row.Pop() + row.Load() } func drawImage(gtx layout.Context, img paint.ImageOp, size unit.Value) layout.Dimensions { - defer op.Push(gtx.Ops).Pop() + defer op.Save(gtx.Ops).Load() img.Add(gtx.Ops) sz := img.Size() aspect := float32(sz.Y) / float32(sz.X) @@ -871,7 +871,7 @@ func drawImage(gtx layout.Context, img paint.ImageOp, size unit.Value) layout.Di } func drawDisc(ops *op.Ops, radius float32, col color.NRGBA) { - defer op.Push(ops).Pop() + defer op.Save(ops).Load() r2 := radius * .5 dr := f32.Rectangle{Max: f32.Pt(radius, radius)} clip.RRect{ @@ -914,7 +914,7 @@ type fill struct { } func (f fill) Layout(gtx layout.Context, sz image.Point) layout.Dimensions { - defer op.Push(gtx.Ops).Pop() + defer op.Save(gtx.Ops).Load() clip.Rect(image.Rectangle{Max: sz}).Add(gtx.Ops) paint.ColorOp{Color: f.col}.Add(gtx.Ops) paint.PaintOp{}.Add(gtx.Ops) diff --git a/go.mod b/go.mod index 4b3b5c0..c08ef26 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.14 require ( eliasnaur.com/font v0.0.0-20200617114307-e02d32decb4b - gioui.org v0.0.0-20210103130323-7bfdafb7b15d + gioui.org v0.0.0-20210303171239-b39d1bdac724 gioui.org/cmd v0.0.0-20201126101740-9b54892cc4e3 github.com/go-bindata/go-bindata v3.1.2+incompatible github.com/tailscale/wireguard-go v0.0.0-20210210202228-3cc76ed5f222 diff --git a/go.sum b/go.sum index f328332..b12c7ef 100644 --- a/go.sum +++ b/go.sum @@ -15,8 +15,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 eliasnaur.com/font v0.0.0-20200617114307-e02d32decb4b h1:J9r7EuPdhvBTafg34EqrObAm/bDEaDh7LvhKJPGficE= eliasnaur.com/font v0.0.0-20200617114307-e02d32decb4b/go.mod h1:CYwJpIhpzVfoHpFXGlXjSx9mXMWtHt4XXmZb6RjumRc= gioui.org v0.0.0-20201119103011-21ef492cc9df/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw= -gioui.org v0.0.0-20210103130323-7bfdafb7b15d h1:VkwllpRglnx7yZAgA3VgrtxO9x9wwBYHReaKygWV8go= -gioui.org v0.0.0-20210103130323-7bfdafb7b15d/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw= +gioui.org v0.0.0-20210303171239-b39d1bdac724 h1:wIJRxf4v7q6HnRmu2yxrKBAffwpGkCJ5PIYd6xAcGfM= +gioui.org v0.0.0-20210303171239-b39d1bdac724/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw= gioui.org/cmd v0.0.0-20201126101740-9b54892cc4e3 h1:WljgIPO0LPLOUhi92gMK7kacyWefdTtAamOFul0NxVI= gioui.org/cmd v0.0.0-20201126101740-9b54892cc4e3/go.mod h1:wLdMwDGN/6zG8SRs7QBEUXf096UcKwco7sSlzehIYho= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=