~gioverse/chat

1ac8bd0d6f8df688ca6c7cb10a3bd08b3c1003c1 — Chris Waldon a month ago 0eafcb0 main
deps,widget/plato,example/*: make compatible with gio a11y changes

This commit updates all code to be compatible with Gio's new
accessibility API changes.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
5 files changed, 51 insertions(+), 55 deletions(-)

M example/kitchen/ui.go
M example/ninepatch/main.go
M go.mod
M go.sum
M widget/plato/message.go
M example/kitchen/ui.go => example/kitchen/ui.go +2 -2
@@ 304,7 304,7 @@ func (ui *UI) layoutChat(gtx C) D {
						func(gtx C) D {
							return ui.layoutEditor(gtx)
						},
						material.IconButton(th.Theme, &ui.AddBtn, Send).Layout,
						material.IconButton(th.Theme, &ui.AddBtn, Send, "Send").Layout,
					)
				})
			})


@@ 334,7 334,7 @@ func (ui *UI) layoutTopbar(gtx C) D {
			}.Layout(
				gtx,
				layout.Rigid(func(gtx C) D {
					btn := material.IconButton(th.Theme, &ui.Back, NavBack)
					btn := material.IconButton(th.Theme, &ui.Back, NavBack, "Back")
					btn.Color = th.Fg
					btn.Background = color.NRGBA{}
					return btn.Layout(gtx)

M example/ninepatch/main.go => example/ninepatch/main.go +1 -1
@@ 321,7 321,7 @@ func (ui *UI) layoutControls(gtx C) D {
					return D{Size: image.Point{X: gtx.Px(unit.Dp(10))}}
				}),
				layout.Rigid(func(gtx C) D {
					return material.Switch(th.Theme, &ui.TextContent).Layout(gtx)
					return material.Switch(th.Theme, &ui.TextContent, "Show Text").Layout(gtx)
				}),
			)
		}),

M go.mod => go.mod +2 -2
@@ 3,8 3,8 @@ module git.sr.ht/~gioverse/chat
go 1.16

require (
	gioui.org v0.0.0-20211026101311-1eab4b84a6d3
	gioui.org/x v0.0.0-20211102210401-cead9283b8ff
	gioui.org v0.0.0-20211202105001-872b4ba41be0
	gioui.org/x v0.0.0-20211201170442-0eb3fcddb9ec
	github.com/drhodes/golorem v0.0.0-20160418191928-ecccc744c2d9
	github.com/lucasb-eyer/go-colorful v1.2.0
	github.com/pkg/profile v1.6.0

M go.sum => go.sum +5 -4
@@ 1,15 1,16 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20211026101311-1eab4b84a6d3 h1:kgz+ANJMlCF5Qd9Rqu8Xu1CKl4asi9AKm440jnZgB8U=
gioui.org v0.0.0-20211026101311-1eab4b84a6d3/go.mod h1:yoWOxPng6WkDpsud+NRmkoftmyWn3rkKsYGEcWHpjTI=
gioui.org v0.0.0-20211201162354-9a5298914282/go.mod h1:yoWOxPng6WkDpsud+NRmkoftmyWn3rkKsYGEcWHpjTI=
gioui.org v0.0.0-20211202105001-872b4ba41be0 h1:rXO+2zdXvX6G19M5oF1fs1U7kmUWb4uXCKWa+WHZSpA=
gioui.org v0.0.0-20211202105001-872b4ba41be0/go.mod h1:yoWOxPng6WkDpsud+NRmkoftmyWn3rkKsYGEcWHpjTI=
gioui.org/cpu v0.0.0-20210808092351-bfe733dd3334/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2 h1:AGDDxsJE1RpcXTAxPG2B4jrwVUJGFDjINIPi1jtO6pc=
gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
gioui.org/shader v1.0.6 h1:cvZmU+eODFR2545X+/8XucgZdTtEjR3QWW6W65b0q5Y=
gioui.org/shader v1.0.6/go.mod h1:mWdiME581d/kV7/iEhLmUgUK5iZ09XR5XpduXzbePVM=
gioui.org/x v0.0.0-20211102210401-cead9283b8ff h1:hAKQjgj7vEgfU57xwS2QEC0lcdRBpjK8egdlHI0QNbg=
gioui.org/x v0.0.0-20211102210401-cead9283b8ff/go.mod h1:2SCbAJkcrS1ZQ8OlpswBRbDwOfLhKRPlSgz/HCpCXJA=
gioui.org/x v0.0.0-20211201170442-0eb3fcddb9ec h1:0+3zD3KsYZTX5yrd80utcG8VBZ/QLIemnkKFQEHn14A=
gioui.org/x v0.0.0-20211201170442-0eb3fcddb9ec/go.mod h1:Xu4qsdcdrC0yk+YUJgXq/cboLbAlXnz1Z7t3FleroWA=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=

M widget/plato/message.go => widget/plato/message.go +41 -46
@@ 157,50 157,45 @@ func (m MessageStyle) Layout(gtx C) (d D) {
		return m.Content.Layout(gtx)
	})
	macro.Stop()
	return layout.Stack{}.Layout(gtx,
		layout.Expanded(func(gtx C) D {
			if !m.Clickable {
				return D{}
			}
			return m.Interaction.Clickable.Layout(gtx)
		}),
		layout.Stacked(func(gtx C) D {
			return surface(gtx, func(gtx C) D {
				return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
					layout.Rigid(func(gtx C) D {
						return layout.Inset{
							Top:  m.ContentPadding.Top,
							Left: m.ContentPadding.Left,
						}.Layout(gtx, m.Content.Layout)
					}),
					layout.Rigid(func(gtx C) D {
						width := gtx.Px(m.MinMessageWidth)
						if dims.Size.X > width {
							width = dims.Size.X
						}
						gtx.Constraints.Max.X = gtx.Constraints.Constrain(image.Pt(width, 0)).X
						return layout.Inset{
							Bottom: m.ContentPadding.Right,
							Right:  m.ContentPadding.Bottom,
						}.Layout(gtx, func(gtx C) D {
							return layout.Flex{
								Axis:      layout.Horizontal,
								Alignment: layout.Middle,
							}.Layout(gtx,
								layout.Flexed(1, func(gtx C) D {
									return D{Size: gtx.Constraints.Min}
								}),
								layout.Rigid(func(gtx C) D {
									return m.Time.Layout(gtx)
								}),
								layout.Rigid(func(gtx C) D {
									return m.Receipt.Layout(gtx, m.TickIconColor)
								}),
							)
						})
					}),
				)
			})
		}),
	)
	if !m.Clickable {
		return D{}
	}
	return m.Interaction.Clickable.Layout(gtx, func(gtx C) D {
		return surface(gtx, func(gtx C) D {
			return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
				layout.Rigid(func(gtx C) D {
					return layout.Inset{
						Top:  m.ContentPadding.Top,
						Left: m.ContentPadding.Left,
					}.Layout(gtx, m.Content.Layout)
				}),
				layout.Rigid(func(gtx C) D {
					width := gtx.Px(m.MinMessageWidth)
					if dims.Size.X > width {
						width = dims.Size.X
					}
					gtx.Constraints.Max.X = gtx.Constraints.Constrain(image.Pt(width, 0)).X
					return layout.Inset{
						Bottom: m.ContentPadding.Right,
						Right:  m.ContentPadding.Bottom,
					}.Layout(gtx, func(gtx C) D {
						return layout.Flex{
							Axis:      layout.Horizontal,
							Alignment: layout.Middle,
						}.Layout(gtx,
							layout.Flexed(1, func(gtx C) D {
								return D{Size: gtx.Constraints.Min}
							}),
							layout.Rigid(func(gtx C) D {
								return m.Time.Layout(gtx)
							}),
							layout.Rigid(func(gtx C) D {
								return m.Receipt.Layout(gtx, m.TickIconColor)
							}),
						)
					})
				}),
			)
		})
	})
}