~eliasnaur/scatter

374e4f39b54f2a0f12c40badebd974400f951316 — Elias Naur 5 months ago 2d1995c
cmd/scatter: update gio version

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

M cmd/scatter/ui.go
M go.mod
M go.sum
M cmd/scatter/ui.go => cmd/scatter/ui.go +35 -35
@@ 41,7 41,6 @@ import (

type Env struct {
	insets layout.Inset
	faces  shape.Faces
	client *Client
	redraw func()
}


@@ 182,11 181,9 @@ type ShowThreadEvent struct {
	Thread string
}

var fonts struct {
	regular *sfnt.Font
	bold    *sfnt.Font
	italic  *sfnt.Font
	mono    *sfnt.Font
var families struct {
	primary *shape.Family
	mono    *shape.Family
}

var theme struct {


@@ 197,10 194,14 @@ var theme struct {
}

func uiMain() {
	fonts.regular = mustLoadFont(goregular.TTF)
	fonts.bold = mustLoadFont(gobold.TTF)
	fonts.italic = mustLoadFont(goitalic.TTF)
	fonts.mono = mustLoadFont(gomono.TTF)
	families.primary = &shape.Family{
		Regular: mustLoadFont(goregular.TTF),
		Italic:  mustLoadFont(goitalic.TTF),
		Bold:    mustLoadFont(gobold.TTF),
	}
	families.mono = &shape.Family{
		Regular: mustLoadFont(gomono.TTF),
	}
	var ops op.Ops
	theme.text = colorMaterial(&ops, rgb(0x000000))
	theme.tertText = colorMaterial(&ops, rgb(0xbbbbbb))


@@ 279,7 280,6 @@ func (a *App) run() error {
				}
			case app.UpdateEvent:
				gtx.Reset(&e.Config, e.Size)
				a.env.faces.Reset()
				a.env.insets = layout.Inset{
					Top:    e.Insets.Top,
					Left:   e.Insets.Left,


@@ 455,7 455,7 @@ func (a *App) layoutTimings(gtx *layout.Context) {
		in.Top = unit.Max(gtx, unit.Dp(16), in.Top)
		in.Layout(gtx, func() {
			txt := fmt.Sprintf("m: %d %s", mallocs, a.profile.Timings)
			text.Label{Material: theme.text, Face: a.env.faces.For(fonts.mono), Size: unit.Sp(10), Text: txt}.Layout(gtx)
			text.Label{Material: theme.text, Size: unit.Sp(10), Text: txt}.Layout(gtx, families.mono)
		})
	})
}


@@ 467,7 467,7 @@ func newContactsPage(env *Env) *contactsPage {
			Axis: layout.Vertical,
		},
		searchEdit: &text.Editor{
			Face:         env.faces.For(fonts.regular),
			Family:       families.primary,
			Size:         unit.Sp(20),
			SingleLine:   true,
			Submit:       true,


@@ 585,7 585,7 @@ func (p *contactsPage) contact(gtx *layout.Context, index int) {
			})
		})
		c2 := f.Flexible(1, func() {
			text.Label{Material: theme.text, Face: p.env.faces.For(fonts.regular), Size: unit.Sp(18), Text: contact.Address}.Layout(gtx)
			text.Label{Material: theme.text, Size: unit.Sp(18), Text: contact.Address}.Layout(gtx, families.primary)
		})

		f.Layout(c1, c2)


@@ 660,7 660,7 @@ func newSignInPage(env *Env) *signInPage {
	for _, f := range p.fields {
		f.env = p.env
		f.edit = &text.Editor{
			Face:         env.faces.For(fonts.regular),
			Family:       families.primary,
			Size:         unit.Sp(16),
			SingleLine:   true,
			Hint:         f.Hint,


@@ 692,7 692,7 @@ func (p *signInPage) Layout(gtx *layout.Context) {
	c1 := f.Rigid(func() {
		var t Topbar
		t.Layout(gtx, p.env.insets, func() {
			text.Label{Material: colorMaterial(gtx.Ops, rgb(0xffffff)), Face: p.env.faces.For(fonts.regular), Size: unit.Sp(20), Text: "Sign in"}.Layout(gtx)
			text.Label{Material: colorMaterial(gtx.Ops, rgb(0xffffff)), Size: unit.Sp(20), Text: "Sign in"}.Layout(gtx, families.primary)
		})
	})



@@ 734,10 734,11 @@ func (f *formField) Layout(gtx *layout.Context) {
	theme.text.Add(gtx.Ops)
	fl := (&layout.Flex{Axis: layout.Vertical}).Init(gtx)

	header := text.Label{Material: theme.text, Text: f.Header, Face: f.env.faces.For(fonts.bold), Size: unit.Sp(12)}
	header := text.Label{Material: theme.text, Text: f.Header, Size: unit.Sp(12)}
	header.Face.Weight = text.Bold
	c1 := fl.Rigid(func() {
		gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
		header.Layout(gtx)
		header.Layout(gtx, families.primary)
		gtx.Dimensions.Size.Y += gtx.Px(unit.Dp(4))
	})
	c2 := fl.Rigid(func() {


@@ 771,8 772,8 @@ func (b *Button) Layout(gtx *layout.Context, env *Env) {
		Inset:    layout.UniformInset(unit.Dp(8)),
	}
	bg.Layout(gtx, func() {
		lbl := text.Label{Material: theme.white, Face: env.faces.For(fonts.regular), Size: unit.Sp(16), Text: b.Label, Alignment: text.Middle}
		lbl.Layout(gtx)
		lbl := text.Label{Material: theme.white, Size: unit.Sp(16), Text: b.Label, Alignment: text.Middle}
		lbl.Layout(gtx, families.primary)
	})
	pointer.RectAreaOp{Rect: image.Rectangle{Max: gtx.Dimensions.Size}}.Add(gtx.Ops)
	b.click.Add(gtx.Ops)


@@ 880,7 881,7 @@ func (p *threadsPage) Layout(gtx *layout.Context) {
		c1 := f.Rigid(func() {
			var t Topbar
			t.Layout(gtx, p.env.insets, func() {
				text.Label{Material: theme.white, Face: p.env.faces.For(fonts.regular), Size: unit.Sp(20), Text: p.account.User}.Layout(gtx)
				text.Label{Material: theme.white, Size: unit.Sp(20), Text: p.account.User}.Layout(gtx, families.primary)
			})
		})



@@ 933,10 934,10 @@ var contactColors = []color.RGBA{
func (p *threadsPage) thread(gtx *layout.Context, index int) {
	t := p.threads[index]
	bgtexmat := theme.tertText
	font := fonts.regular
	face := text.Face{}
	if t.Unread > 0 {
		bgtexmat = theme.text
		font = fonts.bold
		face.Weight = text.Bold
	}
	click := &p.clicks[index]
	in := layout.Inset{


@@ 975,8 976,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
									initial = string(unicode.ToUpper(c))
									break
								}
								face := p.env.faces.For(fonts.regular)
								text.Label{Material: theme.white, Face: face, Size: unit.Sp(24), Text: initial}.Layout(gtx)
								text.Label{Material: theme.white, Size: unit.Sp(24), Text: initial}.Layout(gtx, families.primary)
							})
							st.Layout(c1, c2)
						})


@@ 989,7 989,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
						f := baseline()
						f.Init(gtx)
						c1 := f.Rigid(func() {
							text.Label{Material: theme.text, Face: p.env.faces.For(font), Size: unit.Sp(18), Text: t.ID}.Layout(gtx)
							text.Label{Material: theme.text, Face: face, Size: unit.Sp(18), Text: t.ID}.Layout(gtx, families.primary)
						})
						c2 := f.Flexible(1, func() {
							gtx.Constraints.Width.Min = gtx.Constraints.Width.Max


@@ 998,10 998,10 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
								text.Label{
									Alignment: text.End,
									Material:  bgtexmat,
									Face:      p.env.faces.For(font),
									Face:      face,
									Size:      unit.Sp(12),
									Text:      formatTime(t.Updated),
								}.Layout(gtx)
								}.Layout(gtx, families.primary)
							})
						})
						f.Layout(c1, c2)


@@ 1009,7 1009,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
					c2 := f.Rigid(func() {
						in := layout.Inset{Top: unit.Dp(6)}
						in.Layout(gtx, func() {
							text.Label{Material: bgtexmat, Face: p.env.faces.For(font), Size: unit.Sp(14), MaxLines: 1, Text: t.Snippet}.Layout(gtx)
							text.Label{Material: bgtexmat, Face: face, Size: unit.Sp(14), MaxLines: 1, Text: t.Snippet}.Layout(gtx, families.primary)
						})
					})
					f.Layout(c1, c2)


@@ 1035,7 1035,7 @@ func newThreadPage(env *Env, threadID string) *threadPage {
		},
		result: make(chan []*Message, 1),
		msgEdit: &text.Editor{
			Face:         env.faces.For(fonts.regular),
			Family:       families.primary,
			Size:         unit.Sp(14),
			Submit:       true,
			Hint:         "Send a message",


@@ 1117,7 1117,7 @@ func (p *threadPage) Layout(gtx *layout.Context) {
	f.Init(gtx)
	c1 := f.Rigid(func() {
		p.topbar.Layout(gtx, p.env.insets, func() {
			text.Label{Material: theme.white, Face: p.env.faces.For(fonts.regular), Size: unit.Sp(20), Text: p.thread.ID}.Layout(gtx)
			text.Label{Material: theme.white, Size: unit.Sp(20), Text: p.thread.ID}.Layout(gtx, families.primary)
		})
	})



@@ 1213,8 1213,8 @@ func (p *threadPage) message(gtx *layout.Context, index int) {

				var msgWidth int
				c1 := f.Rigid(func() {
					label := text.Label{Material: msgMat, Face: p.env.faces.For(fonts.regular), Size: unit.Sp(14), Text: msg.Message}
					label.Layout(gtx)
					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
				})


@@ 1227,8 1227,8 @@ func (p *threadPage) message(gtx *layout.Context, index int) {
					var children []layout.FlexChild
					child := f.Rigid(func() {
						time := formatTime(msg.Time)
						tlbl := text.Label{Material: colorMaterial(gtx.Ops, timecol), Face: p.env.faces.For(fonts.regular), Size: unit.Sp(10), Text: time}
						tlbl.Layout(gtx)
						tlbl := text.Label{Material: colorMaterial(gtx.Ops, timecol), Size: unit.Sp(10), Text: time}
						tlbl.Layout(gtx, families.primary)
					})
					children = append(children, child)


M go.mod => go.mod +1 -1
@@ 3,7 3,7 @@ module scatter.im
go 1.13

require (
	gioui.org v0.0.0-20191005093250-404a065a0e03
	gioui.org v0.0.0-20191005205337-1b445944119b
	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-20191005093250-404a065a0e03 h1:TB8lM0pzF2mOM/PQ5MVHBmVLeY+l+ziP/K3ItF3nDys=
gioui.org v0.0.0-20191005093250-404a065a0e03/go.mod h1:+CEjc9B//HrBfWsQOVxjCyih7HGIj3Pww1xFHVDZyyk=
gioui.org v0.0.0-20191005205337-1b445944119b h1:OABWy71Tu7Fe0NdwRcBPCHZrS5ORwZzrKGl189NcAoE=
gioui.org v0.0.0-20191005205337-1b445944119b/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=