From 447ac4125f4d4202a273d1e8f08f0e877545fa91 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 5 Nov 2020 17:21:35 +0100 Subject: [PATCH] update to latest Gio version Signed-off-by: Elias Naur --- cmd/scatter/ui.go | 31 ++++++++++++++++--------------- go.mod | 2 +- go.sum | 6 ++---- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/cmd/scatter/ui.go b/cmd/scatter/ui.go index a88f04c..7980dc8 100644 --- a/cmd/scatter/ui.go +++ b/cmd/scatter/ui.go @@ -8,6 +8,7 @@ import ( "image/color" "log" "math" + "os" "runtime" "strings" "time" @@ -189,6 +190,7 @@ func uiMain() { if err := newApp(w).run(); err != nil { log.Fatal(err) } + os.Exit(0) }() app.Main() } @@ -314,10 +316,10 @@ func (t *Transition) Layout(gtx layout.Context) layout.Dimensions { clipCenter := f32.Point{X: diameter / 2, Y: diameter / 2} off := f32.Affine2D{}.Offset(center.Sub(clipCenter)) op.Affine(off).Add(gtx.Ops) - clip.Rect{ + clip.RRect{ Rect: f32.Rectangle{Max: f32.Point{X: diameter, Y: diameter}}, NE: radius, NW: radius, SE: radius, SW: radius, - }.Op(gtx.Ops).Add(gtx.Ops) + }.Add(gtx.Ops) op.Affine(off.Invert()).Add(gtx.Ops) fill{rgb(0xffffff)}.Layout(gtx) } @@ -586,9 +588,11 @@ func (t *Topbar) Layout(gtx layout.Context, insets layout.Inset, w layout.Widget if !t.Back { return layout.Dimensions{} } + defer op.Push(gtx.Ops).Pop() ico := (&icon{src: icons.NavigationArrowBack, size: unit.Dp(24)}).image(gtx.Metric, rgb(0xffffff)) ico.Add(gtx.Ops) - paint.PaintOp{Rect: f32.Rectangle{Max: toPointF(ico.Size())}}.Add(gtx.Ops) + clip.Rect(image.Rectangle{Max: ico.Size()}).Add(gtx.Ops) + paint.PaintOp{}.Add(gtx.Ops) dims := layout.Dimensions{Size: ico.Size()} dims.Size.X += gtx.Px(unit.Dp(4)) pointer.Rect(image.Rectangle{Max: dims.Size}).Add(gtx.Ops) @@ -717,14 +721,13 @@ func (b *Background) Layout(gtx layout.Context, w layout.Widget) layout.Dimensio if r > height/2 { r = height / 2 } - clip.Rect{ + clip.RRect{ Rect: f32.Rectangle{Max: f32.Point{ X: width, Y: height, }}, NW: r, NE: r, SW: r, SE: r, - }.Op(gtx.Ops).Add(gtx.Ops) + }.Add(gtx.Ops) } - paint.ColorOp{Color: b.Color}.Add(gtx.Ops) - paint.PaintOp{Rect: f32.Rectangle{Max: f32.Point{X: width, Y: height}}}.Add(gtx.Ops) + paint.FillShape(gtx.Ops, b.Color, clip.Rect(image.Rectangle{Max: size}).Op()) call.Add(gtx.Ops) return dims } @@ -1140,7 +1143,9 @@ func (p *threadPage) message(gtx layout.Context, index int) layout.Dimensions { sz := checkmark.Size() if msg.Sent { checkmark.Add(gtx.Ops) - paint.PaintOp{Rect: f32.Rectangle{Max: toPointF(sz)}}.Add(gtx.Ops) + defer op.Push(gtx.Ops).Pop() + clip.Rect(image.Rectangle{Max: sz}).Add(gtx.Ops) + paint.PaintOp{}.Add(gtx.Ops) } return layout.Dimensions{Size: sz} }) @@ -1210,11 +1215,7 @@ type fill struct { func (f fill) Layout(gtx layout.Context) layout.Dimensions { cs := gtx.Constraints d := cs.Min - dr := f32.Rectangle{ - Max: f32.Point{X: float32(d.X), Y: float32(d.Y)}, - } - paint.ColorOp{Color: f.color}.Add(gtx.Ops) - paint.PaintOp{Rect: dr}.Add(gtx.Ops) + paint.FillShape(gtx.Ops, f.color, clip.Rect(image.Rectangle{Max: d}).Op()) return layout.Dimensions{Size: d, Baseline: d.Y} } @@ -1244,10 +1245,10 @@ func (cc *clipCircle) Layout(gtx layout.Context, w layout.Widget) layout.Dimensi szf := float32(max) rr := szf * .5 defer op.Push(gtx.Ops).Pop() - clip.Rect{ + clip.RRect{ Rect: f32.Rectangle{Max: f32.Point{X: szf, Y: szf}}, NE: rr, NW: rr, SE: rr, SW: rr, - }.Op(gtx.Ops).Add(gtx.Ops) + }.Add(gtx.Ops) call.Add(gtx.Ops) return dims } diff --git a/go.mod b/go.mod index c149170..4db1436 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module scatter.im go 1.13 require ( - gioui.org v0.0.0-20200621194428-9e3d3b6f5823 + gioui.org v0.0.0-20201105153219-94d242d18c92 github.com/eliasnaur/libsignal-protocol-go v0.0.0-20190626062856-3295f72b181e github.com/emersion/go-imap v1.0.0-rc.1 github.com/emersion/go-imap-idle v0.0.0-20190519112320-2704abd7050e diff --git a/go.sum b/go.sum index 82952c1..adda689 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -gioui.org v0.0.0-20200621194428-9e3d3b6f5823 h1:Pm6K6MF8VqicZJDTghBsk4lLehw2LceCj1Bkw3moaS4= -gioui.org v0.0.0-20200621194428-9e3d3b6f5823/go.mod h1:jiUwifN9cRl/zmco43aAqh0aV+s9GbhG13KcD+gEpkU= +gioui.org v0.0.0-20201105153219-94d242d18c92 h1:1GHIbWom8jXI3wzPOq5JOT40uEaPUFH9eki/ViecVR8= +gioui.org v0.0.0-20201105153219-94d242d18c92/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/RadicalApp/complete v0.0.0-20170329192659-17e6c0ee499b h1:cAULFohNVfNzco0flF4okSPg3s7/tCj+hMIldtYZo4c= github.com/RadicalApp/complete v0.0.0-20170329192659-17e6c0ee499b/go.mod h1:zZ3+l0EkpT2ZPnoamPBG50PBUtQrXwwyJ6elQZMmqgk= @@ -38,7 +38,6 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A= @@ -47,7 +46,6 @@ golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3 h1:n9HxLrNxWWtEb1cA950nuEEj3QnKbtsCJ6KjcgisNUs= golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20200618115811-c13761719519 h1:1e2ufUJNM3lCHEY5jIgac/7UTjd6cgJNdatjPdFWf34= golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -- 2.45.2