From dd225d5d07f0aaaae77b4562466af66ce8ce3ec3 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 17 Jun 2020 11:51:26 +0200 Subject: [PATCH] example,cmd: bump gio version Signed-off-by: Elias Naur --- cmd/go.mod | 2 +- cmd/go.sum | 4 ++-- example/glfw/main.go | 11 +++++++---- example/go.mod | 2 +- example/go.sum | 4 ++-- example/kitchen/kitchen.go | 20 +++++--------------- 6 files changed, 18 insertions(+), 25 deletions(-) diff --git a/cmd/go.mod b/cmd/go.mod index c8ddbf9b..c2504f85 100644 --- a/cmd/go.mod +++ b/cmd/go.mod @@ -3,7 +3,7 @@ module gioui.org/cmd go 1.13 require ( - gioui.org v0.0.0-20200615160648-c2f99fb0e99c + gioui.org v0.0.0-20200617094714-596e32161041 github.com/chromedp/cdproto v0.0.0-20191114225735-6626966fbae4 github.com/chromedp/chromedp v0.5.2 golang.org/x/image v0.0.0-20190802002840-cff245a6509b diff --git a/cmd/go.sum b/cmd/go.sum index 67b8f23c..bd0e3779 100644 --- a/cmd/go.sum +++ b/cmd/go.sum @@ -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-20200615160648-c2f99fb0e99c h1:5nU1iD464+yYrV946xsTC0jFMcDmY3XAe9dwyizP3PU= -gioui.org v0.0.0-20200615160648-c2f99fb0e99c/go.mod h1:AHI9rFr6AEEHCb8EPVtb/p5M+NMJRKH58IOp8O3Je04= +gioui.org v0.0.0-20200617094714-596e32161041 h1:mogSEMG8m1oAoF9kc7s0ABUkqZK6wq6rswSUCTbqhVs= +gioui.org v0.0.0-20200617094714-596e32161041/go.mod h1:AHI9rFr6AEEHCb8EPVtb/p5M+NMJRKH58IOp8O3Je04= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/chromedp/cdproto v0.0.0-20191114225735-6626966fbae4 h1:QD3KxSJ59L2lxG6MXBjNHxiQO2RmxTQ3XcK+wO44WOg= diff --git a/example/glfw/main.go b/example/glfw/main.go index 2f964a99..1ee6b364 100644 --- a/example/glfw/main.go +++ b/example/glfw/main.go @@ -94,10 +94,13 @@ func main() { sz := image.Point{X: width, Y: height} ops.Reset() gtx := layout.Context{ - Ops: &ops, - Now: time.Now(), - Queue: &queue, - Config: &glfwConfig{scale}, + Ops: &ops, + Now: time.Now(), + Queue: &queue, + Metric: unit.Metric{ + PxPerDp: scale, + PxPerSp: scale, + }, Constraints: layout.Exact(sz), } draw(gtx, th) diff --git a/example/go.mod b/example/go.mod index 86f1f006..c8b73c90 100644 --- a/example/go.mod +++ b/example/go.mod @@ -3,7 +3,7 @@ module gioui.org/example go 1.13 require ( - gioui.org v0.0.0-20200615160648-c2f99fb0e99c + gioui.org v0.0.0-20200617094714-596e32161041 github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72 github.com/google/go-github/v24 v24.0.1 diff --git a/example/go.sum b/example/go.sum index bd095327..6a2b761a 100644 --- a/example/go.sum +++ b/example/go.sum @@ -1,7 +1,7 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -gioui.org v0.0.0-20200615160648-c2f99fb0e99c h1:5nU1iD464+yYrV946xsTC0jFMcDmY3XAe9dwyizP3PU= -gioui.org v0.0.0-20200615160648-c2f99fb0e99c/go.mod h1:AHI9rFr6AEEHCb8EPVtb/p5M+NMJRKH58IOp8O3Je04= +gioui.org v0.0.0-20200617094714-596e32161041 h1:mogSEMG8m1oAoF9kc7s0ABUkqZK6wq6rswSUCTbqhVs= +gioui.org v0.0.0-20200617094714-596e32161041/go.mod h1:AHI9rFr6AEEHCb8EPVtb/p5M+NMJRKH58IOp8O3Je04= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw= github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk= diff --git a/example/kitchen/kitchen.go b/example/kitchen/kitchen.go index 31954ce0..86e6385a 100644 --- a/example/kitchen/kitchen.go +++ b/example/kitchen/kitchen.go @@ -13,7 +13,6 @@ import ( "image/png" "io/ioutil" "log" - "math" "os" "time" @@ -35,10 +34,6 @@ import ( var screenshot = flag.String("screenshot", "", "save a screenshot to a file and exit") var disable = flag.Bool("disable", false, "disable all widgets") -type scaledConfig struct { - Scale float32 -} - type iconAndTextButton struct { theme *material.Theme button *widget.Clickable @@ -87,8 +82,11 @@ func saveScreenshot(f string) error { return err } gtx := layout.Context{ - Ops: new(op.Ops), - Config: &scaledConfig{scale}, + Ops: new(op.Ops), + Metric: unit.Metric{ + PxPerDp: scale, + PxPerSp: scale, + }, Constraints: layout.Exact(sz), Queue: new(router.Router), } @@ -304,14 +302,6 @@ func kitchen(gtx layout.Context, th *material.Theme) layout.Dimensions { }) } -func (s *scaledConfig) Px(v unit.Value) int { - scale := s.Scale - if v.U == unit.UnitPx { - scale = 1 - } - return int(math.Round(float64(scale * v.V))) -} - const longText = `1. I learned from my grandfather, Verus, to use good manners, and to put restraint on anger. 2. In the famous memory of my father I had a pattern of modesty and manliness. 3. Of my mother I learned to be