~eliasnaur/scatter

897f5ef7d59c37f510961fb277218d5cb570bbe6 — Elias Naur 3 years ago 447ac41
go.*,cmd/scatter: upgrade to newest Gio

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

M cmd/scatter/ui.go
M go.mod
M go.sum
M cmd/scatter/ui.go => cmd/scatter/ui.go +17 -17
@@ 179,7 179,7 @@ type (

func uiMain() {
	theme = material.NewTheme(gofont.Collection())
	theme.Color.Primary = rgb(0x3c98c6)
	theme.ContrastBg = rgb(0x3c98c6)
	iconLib.create = mustIcon(icons.ContentCreate)
	iconLib.send = mustIcon(icons.ContentSend)
	go func() {


@@ 399,12 399,12 @@ func mustLoadFont(fontData []byte) *sfnt.Font {
	return fnt
}

func rgb(c uint32) color.RGBA {
func rgb(c uint32) color.NRGBA {
	return argb((0xff << 24) | c)
}

func argb(c uint32) color.RGBA {
	return color.RGBA{A: uint8(c >> 24), R: uint8(c >> 16), G: uint8(c >> 8), B: uint8(c)}
func argb(c uint32) color.NRGBA {
	return color.NRGBA{A: uint8(c >> 24), R: uint8(c >> 16), G: uint8(c >> 8), B: uint8(c)}
}

func (a *App) Layout(gtx layout.Context) {


@@ 512,7 512,7 @@ func (p *contactsPage) Layout(gtx layout.Context) layout.Dimensions {
	}
	l := p.list
	if l.Dragging() {
		key.HideInputOp{}.Add(gtx.Ops)
		key.SoftKeyboardOp{Show: false}.Add(gtx.Ops)
	}
	return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
		layout.Rigid(func(gtx C) D {


@@ 551,7 551,7 @@ func (p *contactsPage) contact(gtx layout.Context, index int) layout.Dimensions 
					return cc.Layout(gtx, func(gtx C) D {
						sz := image.Point{X: gtx.Px(unit.Dp(48)), Y: gtx.Px(unit.Dp(48))}
						gtx.Constraints = layout.Exact(gtx.Constraints.Constrain(sz))
						return fill{theme.Color.Primary}.Layout(gtx)
						return fill{theme.ContrastBg}.Layout(gtx)
					})
				})
			}),


@@ 580,7 580,7 @@ func (t *Topbar) Layout(gtx layout.Context, insets layout.Inset, w layout.Widget
		Right:  unit.Max(gtx.Metric, insets.Right, unit.Dp(16)),
	}
	return layout.Stack{Alignment: layout.SW}.Layout(gtx,
		layout.Expanded(fill{theme.Color.Primary}.Layout),
		layout.Expanded(fill{theme.ContrastBg}.Layout),
		layout.Stacked(func(gtx C) D {
			return insets.Layout(gtx, func(gtx C) D {
				return layout.Flex{Alignment: layout.Middle}.Layout(gtx,


@@ 702,7 702,7 @@ func (f *formField) Layout(gtx layout.Context) layout.Dimensions {
}

type Background struct {
	Color  color.RGBA
	Color  color.NRGBA
	Radius unit.Value
	Inset  layout.Inset
}


@@ 822,7 822,7 @@ func (p *threadsPage) Layout(gtx layout.Context) layout.Dimensions {
func (p *threadsPage) layoutThreads(gtx layout.Context) layout.Dimensions {
	l := p.list
	if l.Dragging() {
		key.HideInputOp{}.Add(gtx.Ops)
		key.SoftKeyboardOp{Show: false}.Add(gtx.Ops)
	}
	return l.Layout(gtx, len(p.threads), func(gtx C, i int) D {
		in := layout.Inset{}


@@ 838,7 838,7 @@ func (p *threadsPage) layoutThreads(gtx layout.Context) layout.Dimensions {
	})
}

var contactColors = []color.RGBA{
var contactColors = []color.NRGBA{
	{A: 0xff, R: 0xef, G: 0x6c, B: 0x00},
	{A: 0xff, R: 0x00, G: 0x57, B: 0x9b},
	{A: 0xff, R: 0x00, G: 0x97, B: 0xa7},


@@ 852,7 852,7 @@ func (p *threadsPage) thread(gtx layout.Context, index int) layout.Dimensions {
	bgtexcol := rgb(0xbbbbbb)
	fontWeight := text.Normal
	if t.Unread > 0 {
		bgtexcol = theme.Color.Text
		bgtexcol = theme.Fg
		fontWeight = text.Bold
	}
	click := &p.clicks[index]


@@ 1006,7 1006,7 @@ func (p *threadPage) sendMessage() {
func (p *threadPage) Layout(gtx layout.Context) layout.Dimensions {
	l := p.list
	if l.Dragging() {
		key.HideInputOp{}.Add(gtx.Ops)
		key.SoftKeyboardOp{Show: false}.Add(gtx.Ops)
	}
	select {
	case p.messages = <-p.result:


@@ 1092,13 1092,13 @@ func (p *threadPage) message(gtx layout.Context, index int) layout.Dimensions {
	in := layout.Inset{Top: unit.Dp(16), Left: unit.Dp(16), Right: unit.Dp(40)}
	align := layout.W
	msgCol := rgb(0xffffff)
	bgcol := theme.Color.Primary
	bgcol := theme.ContrastBg
	timecol := argb(0xaaaaaaaa)
	if msg.Own {
		in.Left, in.Right = in.Right, in.Left
		align = layout.E
		bgcol = rgb(0xeeeeee)
		msgCol = theme.Color.Text
		msgCol = theme.Fg
		timecol = rgb(0x888888)
	}
	in.Left = unit.Max(gtx.Metric, in.Left, p.env.insets.Left)


@@ 1209,7 1209,7 @@ func (a *App) update(gtx layout.Context) {
}

type fill struct {
	color color.RGBA
	color color.NRGBA
}

func (f fill) Layout(gtx layout.Context) layout.Dimensions {


@@ 1257,7 1257,7 @@ func toPointF(p image.Point) f32.Point {
	return f32.Point{X: float32(p.X), Y: float32(p.Y)}
}

func (ic *icon) image(c unit.Metric, col color.RGBA) paint.ImageOp {
func (ic *icon) image(c unit.Metric, col color.NRGBA) paint.ImageOp {
	sz := c.Px(ic.size)
	if sz == ic.imgSize {
		return ic.op


@@ 1267,7 1267,7 @@ func (ic *icon) image(c unit.Metric, col color.RGBA) paint.ImageOp {
	img := image.NewRGBA(image.Rectangle{Max: image.Point{X: sz, Y: int(float32(sz) * dy / dx)}})
	var ico iconvg.Rasterizer
	ico.SetDstImage(img, img.Bounds(), draw.Src)
	m.Palette[0] = col
	m.Palette[0] = color.RGBAModel.Convert(col).(color.RGBA)
	iconvg.Decode(&ico, ic.src, &iconvg.DecodeOptions{
		Palette: &m.Palette,
	})

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

require (
	gioui.org v0.0.0-20201105153219-94d242d18c92
	gioui.org v0.0.0-20210111133228-f114acdb022e
	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,6 1,6 @@
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20201105153219-94d242d18c92 h1:1GHIbWom8jXI3wzPOq5JOT40uEaPUFH9eki/ViecVR8=
gioui.org v0.0.0-20201105153219-94d242d18c92/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw=
gioui.org v0.0.0-20210111133228-f114acdb022e h1:eZ+YiMsk7ojPANgBImLkoqxkt+CGMSQ+GRgzf2jAlVo=
gioui.org v0.0.0-20210111133228-f114acdb022e/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=