5696eef64977f09a543e15c1803b18c171d0ce95 — Elias Naur a month ago 374e4f3
cmd/scatter: update gio version

Signed-off-by: Elias Naur <mail@eliasnaur.com>
3 files changed, 57 insertions(+), 71 deletions(-)

M cmd/scatter/ui.go
M go.mod
M go.sum
M cmd/scatter/ui.go => cmd/scatter/ui.go +54 -68
@@ 547,19 547,18 @@ func (p *contactsPage) Layout(gtx *layout.Context) {
 		key.HideInputOp{}.Add(gtx.Ops)
 	}
 	f := layout.Flex{Axis: layout.Vertical}
-	f.Init(gtx)
-	c1 := f.Rigid(func() {
+	c1 := f.Rigid(gtx, func() {
 		p.topbar.Layout(gtx, p.env.insets, func() {
 			p.searchEdit.Layout(gtx)
 		})
 	})
-	c2 := f.Flexible(1, func() {
+	c2 := f.Flex(gtx, 1, func() {
 		gtx.Constraints.Height.Min = gtx.Constraints.Height.Max
 		l.Layout(gtx, len(p.contacts), func(i int) {
 			p.contact(gtx, i)
 		})
 	})
-	f.Layout(c1, c2)
+	f.Layout(gtx, c1, c2)
 }
 
 func (p *contactsPage) contact(gtx *layout.Context, index int) {


@@ 572,8 571,8 @@ func (p *contactsPage) contact(gtx *layout.Context, index int) {
 	contact := p.contacts[index]
 	click := &p.clicks[index]
 	in.Layout(gtx, func() {
-		f := (&layout.Flex{Alignment: layout.Middle}).Init(gtx)
-		c1 := f.Rigid(func() {
+		f := layout.Flex{Alignment: layout.Middle}
+		c1 := f.Rigid(gtx, func() {
 			in := layout.Inset{Right: unit.Dp(8)}
 			in.Layout(gtx, func() {
 				cc := clipCircle{}


@@ 584,11 583,11 @@ func (p *contactsPage) contact(gtx *layout.Context, index int) {
 				})
 			})
 		})
-		c2 := f.Flexible(1, func() {
+		c2 := f.Flex(gtx, 1, func() {
 			text.Label{Material: theme.text, Size: unit.Sp(18), Text: contact.Address}.Layout(gtx, families.primary)
 		})
 
-		f.Layout(c1, c2)
+		f.Layout(gtx, c1, c2)
 	})
 	pointer.RectAreaOp{Rect: image.Rectangle{Max: gtx.Dimensions.Size}}.Add(gtx.Ops)
 	click.Add(gtx.Ops)


@@ 611,12 610,10 @@ func (t *Topbar) Layout(gtx *layout.Context, insets layout.Inset, w layout.Widge
 		Left:   unit.Max(gtx, insets.Left, unit.Dp(16)),
 		Right:  unit.Max(gtx, insets.Right, unit.Dp(16)),
 	}
-	stack.Init(gtx)
-	stackContent := stack.Rigid(func() {
+	stackContent := stack.Rigid(gtx, func() {
 		insets.Layout(gtx, func() {
 			flex := layout.Flex{Alignment: layout.Middle}
-			flex.Init(gtx)
-			backChild := flex.Rigid(func() {
+			backChild := flex.Rigid(gtx, func() {
 				if t.Back {
 					ico := (&icon{src: icons.NavigationArrowBack, size: unit.Dp(24)}).image(gtx, rgb(0xffffff))
 					widget.Image{Src: ico, Rect: ico.Bounds(), Scale: 1}.Layout(gtx)


@@ 625,14 622,14 @@ func (t *Topbar) Layout(gtx *layout.Context, insets layout.Inset, w layout.Widge
 					t.backClick.Add(gtx.Ops)
 				}
 			})
-			content := flex.Flexible(1, w)
-			flex.Layout(backChild, content)
+			content := flex.Flex(gtx, 1, w)
+			flex.Layout(gtx, backChild, content)
 		})
 	})
-	bg := stack.Expand(func() {
+	bg := stack.Expand(gtx, func() {
 		fill{theme.brand}.Layout(gtx)
 	})
-	stack.Layout(bg, stackContent)
+	stack.Layout(gtx, bg, stackContent)
 }
 
 func newSignInPage(env *Env) *signInPage {


@@ 687,19 684,18 @@ func (p *signInPage) Event(gtx *layout.Context) interface{} {
 
 func (p *signInPage) Layout(gtx *layout.Context) {
 	f := layout.Flex{Axis: layout.Vertical}
-	f.Init(gtx)
 
-	c1 := f.Rigid(func() {
+	c1 := f.Rigid(gtx, func() {
 		var t Topbar
 		t.Layout(gtx, p.env.insets, func() {
 			text.Label{Material: colorMaterial(gtx.Ops, rgb(0xffffff)), Size: unit.Sp(20), Text: "Sign in"}.Layout(gtx, families.primary)
 		})
 	})
 
-	c2 := f.Flexible(1, func() {
+	c2 := f.Flex(gtx, 1, func() {
 		p.layoutSigninForm(gtx)
 	})
-	f.Layout(c1, c2)
+	f.Layout(gtx, c1, c2)
 }
 
 func (p *signInPage) layoutSigninForm(gtx *layout.Context) {


@@ 732,19 728,19 @@ func (p *signInPage) layoutSigninForm(gtx *layout.Context) {
 
 func (f *formField) Layout(gtx *layout.Context) {
 	theme.text.Add(gtx.Ops)
-	fl := (&layout.Flex{Axis: layout.Vertical}).Init(gtx)
+	fl := layout.Flex{Axis: layout.Vertical}
 
 	header := text.Label{Material: theme.text, Text: f.Header, Size: unit.Sp(12)}
 	header.Face.Weight = text.Bold
-	c1 := fl.Rigid(func() {
+	c1 := fl.Rigid(gtx, func() {
 		gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
 		header.Layout(gtx, families.primary)
 		gtx.Dimensions.Size.Y += gtx.Px(unit.Dp(4))
 	})
-	c2 := fl.Rigid(func() {
+	c2 := fl.Rigid(gtx, func() {
 		f.edit.Layout(gtx)
 	})
-	fl.Layout(c1, c2)
+	fl.Layout(gtx, c1, c2)
 }
 
 func (b *buttonState) Clicked(gtx *layout.Context) bool {


@@ 872,25 868,23 @@ func (p *threadsPage) fetchThreads() {
 
 func (p *threadsPage) Layout(gtx *layout.Context) {
 	st := layout.Stack{Alignment: layout.Center}
-	st.Init(gtx)
 
-	c1 := st.Rigid(func() {
+	c1 := st.Rigid(gtx, func() {
 		f := layout.Flex{Axis: layout.Vertical}
-		f.Init(gtx)
 
-		c1 := f.Rigid(func() {
+		c1 := f.Rigid(gtx, func() {
 			var t Topbar
 			t.Layout(gtx, p.env.insets, func() {
 				text.Label{Material: theme.white, Size: unit.Sp(20), Text: p.account.User}.Layout(gtx, families.primary)
 			})
 		})
 
-		c2 := f.Flexible(1, func() {
+		c2 := f.Flex(gtx, 1, func() {
 			p.layoutThreads(gtx)
 		})
-		f.Layout(c1, c2)
+		f.Layout(gtx, c1, c2)
 	})
-	c2 := st.Rigid(func() {
+	c2 := st.Rigid(gtx, func() {
 		layout.Align(layout.SE).Layout(gtx, func() {
 			layout.Inset{
 				Right:  unit.Max(gtx, unit.Dp(16), p.env.insets.Right),


@@ 900,7 894,7 @@ func (p *threadsPage) Layout(gtx *layout.Context) {
 			})
 		})
 	})
-	st.Layout(c1, c2)
+	st.Layout(gtx, c1, c2)
 }
 
 func (p *threadsPage) layoutThreads(gtx *layout.Context) {


@@ 946,22 940,19 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
 	}
 	in.Layout(gtx, func() {
 		elem := layout.Flex{Axis: layout.Vertical}
-		elem.Init(gtx)
-		c1 := elem.Rigid(func() {
+		c1 := elem.Rigid(gtx, func() {
 			in := layout.Inset{Top: unit.Dp(8), Bottom: unit.Dp(8)}
 			in.Layout(gtx, func() {
 				f := centerRowOpts()
-				f.Init(gtx)
-				c1 := f.Rigid(func() {
+				c1 := f.Rigid(gtx, func() {
 					in := layout.Inset{Right: unit.Dp(12)}
 					cc := clipCircle{}
 					in.Layout(gtx, func() {
 						cc.Layout(gtx, func() {
 							st := layout.Stack{Alignment: layout.Center}
-							st.Init(gtx)
 
 							// Background color
-							c1 := st.Rigid(func() {
+							c1 := st.Rigid(gtx, func() {
 								sz := image.Point{X: gtx.Px(unit.Dp(48)), Y: gtx.Px(unit.Dp(48))}
 								gtx.Constraints = layout.RigidConstraints(gtx.Constraints.Constrain(sz))
 								color := contactColors[index%len(contactColors)]


@@ 970,7 961,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
 							})
 
 							// Contact initial.
-							c2 := st.Rigid(func() {
+							c2 := st.Rigid(gtx, func() {
 								initial := ""
 								for _, c := range t.ID {
 									initial = string(unicode.ToUpper(c))


@@ 978,20 969,18 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
 								}
 								text.Label{Material: theme.white, Size: unit.Sp(24), Text: initial}.Layout(gtx, families.primary)
 							})
-							st.Layout(c1, c2)
+							st.Layout(gtx, c1, c2)
 						})
 					})
 				})
-				c2 := f.Rigid(func() {
+				c2 := f.Rigid(gtx, func() {
 					f := column()
-					f.Init(gtx)
-					c1 := f.Rigid(func() {
+					c1 := f.Rigid(gtx, func() {
 						f := baseline()
-						f.Init(gtx)
-						c1 := f.Rigid(func() {
+						c1 := f.Rigid(gtx, func() {
 							text.Label{Material: theme.text, Face: face, Size: unit.Sp(18), Text: t.ID}.Layout(gtx, families.primary)
 						})
-						c2 := f.Flexible(1, func() {
+						c2 := f.Flex(gtx, 1, func() {
 							gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
 							in := layout.Inset{Left: unit.Dp(2)}
 							in.Layout(gtx, func() {


@@ 1004,22 993,22 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
 								}.Layout(gtx, families.primary)
 							})
 						})
-						f.Layout(c1, c2)
+						f.Layout(gtx, c1, c2)
 					})
-					c2 := f.Rigid(func() {
+					c2 := f.Rigid(gtx, func() {
 						in := layout.Inset{Top: unit.Dp(6)}
 						in.Layout(gtx, func() {
 							text.Label{Material: bgtexmat, Face: face, Size: unit.Sp(14), MaxLines: 1, Text: t.Snippet}.Layout(gtx, families.primary)
 						})
 					})
-					f.Layout(c1, c2)
+					f.Layout(gtx, c1, c2)
 				})
-				f.Layout(c1, c2)
+				f.Layout(gtx, c1, c2)
 			})
 			pointer.RectAreaOp{Rect: image.Rectangle{Max: gtx.Dimensions.Size}}.Add(gtx.Ops)
 			click.Add(gtx.Ops)
 		})
-		elem.Layout(c1)
+		elem.Layout(gtx, c1)
 	})
 }
 


@@ 1114,14 1103,13 @@ func (p *threadPage) Layout(gtx *layout.Context) {
 	default:
 	}
 	f := layout.Flex{Axis: layout.Vertical}
-	f.Init(gtx)
-	c1 := f.Rigid(func() {
+	c1 := f.Rigid(gtx, func() {
 		p.topbar.Layout(gtx, p.env.insets, func() {
 			text.Label{Material: theme.white, Size: unit.Sp(20), Text: p.thread.ID}.Layout(gtx, families.primary)
 		})
 	})
 
-	c3 := f.Rigid(func() {
+	c3 := f.Rigid(gtx, func() {
 		in := layout.Inset{
 			Top:    unit.Dp(16),
 			Left:   unit.Max(gtx, unit.Dp(16), p.env.insets.Left),


@@ 1140,23 1128,23 @@ func (p *threadPage) Layout(gtx *layout.Context) {
 		})
 	})
 
-	c2 := f.Flexible(1, func() {
+	c2 := f.Flex(gtx, 1, func() {
 		gtx.Constraints.Height.Min = gtx.Constraints.Height.Max
 		l.Layout(gtx, len(p.messages), func(i int) {
 			p.message(gtx, i)
 		})
 	})
-	f.Layout(c1, c2, c3)
+	f.Layout(gtx, c1, c2, c3)
 }
 
 func (p *threadPage) layoutMessageBox(gtx *layout.Context) {
 	if mh := gtx.Px(unit.Dp(100)); gtx.Constraints.Height.Max > mh {
 		gtx.Constraints.Height.Max = mh
 	}
-	f := (&layout.Flex{Alignment: layout.End}).Init(gtx)
+	f := layout.Flex{Alignment: layout.End}
 
 	var sendHeight int
-	c2 := f.Rigid(func() {
+	c2 := f.Rigid(gtx, func() {
 		in := layout.Inset{Left: unit.Dp(8)}
 		in.Layout(gtx, func() {
 			p.send.Layout(gtx)


@@ 1164,7 1152,7 @@ func (p *threadPage) layoutMessageBox(gtx *layout.Context) {
 		})
 	})
 
-	c1 := f.Flexible(1, func() {
+	c1 := f.Flex(gtx, 1, func() {
 		gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
 		if gtx.Constraints.Height.Min < sendHeight {
 			gtx.Constraints.Height.Min = sendHeight


@@ 1181,7 1169,7 @@ func (p *threadPage) layoutMessageBox(gtx *layout.Context) {
 			})
 		})
 	})
-	f.Layout(c1, c2)
+	f.Layout(gtx, c1, c2)
 }
 
 func (p *threadPage) message(gtx *layout.Context, index int) {


@@ 1209,23 1197,21 @@ func (p *threadPage) message(gtx *layout.Context, index int) {
 			}
 			bg.Layout(gtx, func() {
 				f := layout.Flex{Axis: layout.Vertical}
-				f.Init(gtx)
 
 				var msgWidth int
-				c1 := f.Rigid(func() {
+				c1 := f.Rigid(gtx, func() {
 					label := text.Label{Material: msgMat, Size: unit.Sp(14), Text: msg.Message}
 					label.Layout(gtx, families.primary)
 					gtx.Dimensions.Size.Y += gtx.Px(unit.Dp(4))
 					msgWidth = gtx.Dimensions.Size.X
 				})
 
-				c2 := f.Rigid(func() {
+				c2 := f.Rigid(gtx, func() {
 					gtx.Constraints.Width.Min = msgWidth
 					f := layout.Flex{Axis: layout.Horizontal, Spacing: layout.SpaceBetween, Alignment: layout.Middle}
-					f.Init(gtx)
 
 					var children []layout.FlexChild
-					child := f.Rigid(func() {
+					child := f.Rigid(gtx, func() {
 						time := formatTime(msg.Time)
 						tlbl := text.Label{Material: colorMaterial(gtx.Ops, timecol), Size: unit.Sp(10), Text: time}
 						tlbl.Layout(gtx, families.primary)


@@ 1233,7 1219,7 @@ func (p *threadPage) message(gtx *layout.Context, index int) {
 					children = append(children, child)
 
 					if msg.Own {
-						child := f.Rigid(func() {
+						child := f.Rigid(gtx, func() {
 							in := layout.Inset{Left: unit.Dp(12)}
 							in.Layout(gtx, func() {
 								checkmark := p.checkmark.image(gtx, timecol)


@@ 1247,10 1233,10 @@ func (p *threadPage) message(gtx *layout.Context, index int) {
 						})
 						children = append(children, child)
 					}
-					f.Layout(children...)
+					f.Layout(gtx, children...)
 				})
 
-				f.Layout(c1, c2)
+				f.Layout(gtx, c1, c2)
 			})
 		})
 	})

M go.mod => go.mod +1 -1
@@ 3,7 3,7 @@ module scatter.im
 go 1.13
 
 require (
-	gioui.org v0.0.0-20191005205337-1b445944119b
+	gioui.org v0.0.0-20191006072302-e7fabcf77487
 	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

M go.sum => go.sum +2 -2
@@ 1,5 1,5 @@
-gioui.org v0.0.0-20191005205337-1b445944119b h1:OABWy71Tu7Fe0NdwRcBPCHZrS5ORwZzrKGl189NcAoE=
-gioui.org v0.0.0-20191005205337-1b445944119b/go.mod h1:+CEjc9B//HrBfWsQOVxjCyih7HGIj3Pww1xFHVDZyyk=
+gioui.org v0.0.0-20191006072302-e7fabcf77487 h1:JfNhjB3AMgJn0xIJWXao7JHHbLpdDSjuj1+pwan48Do=
+gioui.org v0.0.0-20191006072302-e7fabcf77487/go.mod h1:+CEjc9B//HrBfWsQOVxjCyih7HGIj3Pww1xFHVDZyyk=
 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=