~eliasnaur/gio

7eff3f561f3df167a6125e25ff03be7d93cc8413 — Elias Naur 11 months ago d3fffef
widget: report Enum.Changed only when actually changed

Fixes gio#159

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

M widget/enum.go
M widget/enum.go => widget/enum.go +4 -2
@@ 50,8 50,10 @@ func (e *Enum) Layout(gtx layout.Context, key string) layout.Dimensions {
		for _, ev := range clk.Events(gtx) {
			switch ev.Type {
			case gesture.TypeClick:
				e.Value = e.values[idx]
				e.changed = true
				if new := e.values[idx]; new != e.Value {
					e.Value = new
					e.changed = true
				}
			}
		}
		clk.Add(gtx.Ops)