shiny: rename config.Event to size.Event.
Change-Id: I804aed414c9a3ef7183490c1711aab8dfd2e6de2
Reviewed-on: https://go-review.googlesource.com/13602
Reviewed-by: David Crawshaw <crawshaw@golang.org>
diff --git a/shiny/driver/gldriver/cocoa.go b/shiny/driver/gldriver/cocoa.go
index 941350a..87d175a 100644
--- a/shiny/driver/gldriver/cocoa.go
+++ b/shiny/driver/gldriver/cocoa.go
@@ -22,10 +22,10 @@
"runtime"
"golang.org/x/exp/shiny/screen"
- "golang.org/x/mobile/event/config"
"golang.org/x/mobile/event/lifecycle"
"golang.org/x/mobile/event/mouse"
"golang.org/x/mobile/event/paint"
+ "golang.org/x/mobile/event/size"
"golang.org/x/mobile/geom"
"golang.org/x/mobile/gl"
)
@@ -132,7 +132,7 @@
w := theScreen.windows[id]
theScreen.mu.Unlock()
- cfg := config.Event{
+ sz := size.Event{
WidthPx: widthPx,
HeightPx: heightPx,
WidthPt: geom.Pt(float32(widthPx) / ppp),
@@ -141,10 +141,10 @@
}
w.mu.Lock()
- w.cfg = cfg
+ w.sz = sz
w.mu.Unlock()
- w.Send(cfg)
+ w.Send(sz)
}
func sendWindowEvent(id uintptr, e interface{}) {
diff --git a/shiny/driver/gldriver/window.go b/shiny/driver/gldriver/window.go
index 959db1f..b07e461 100644
--- a/shiny/driver/gldriver/window.go
+++ b/shiny/driver/gldriver/window.go
@@ -16,8 +16,8 @@
"golang.org/x/exp/shiny/driver/internal/pump"
"golang.org/x/exp/shiny/screen"
"golang.org/x/image/math/f64"
- "golang.org/x/mobile/event/config"
"golang.org/x/mobile/event/paint"
+ "golang.org/x/mobile/event/size"
"golang.org/x/mobile/gl"
)
@@ -31,8 +31,8 @@
draw chan struct{}
drawDone chan struct{}
- mu sync.Mutex
- cfg config.Event
+ mu sync.Mutex
+ sz size.Event
}
func (w *windowImpl) Release() {
@@ -95,12 +95,12 @@
func (w *windowImpl) vertexAff3(r image.Rectangle) f64.Aff3 {
w.mu.Lock()
- cfg := w.cfg
+ sz := w.sz
w.mu.Unlock()
size := r.Size()
tx, ty := float64(size.X), float64(size.Y)
- wx, wy := float64(cfg.WidthPx), float64(cfg.HeightPx)
+ wx, wy := float64(sz.WidthPx), float64(sz.HeightPx)
rx, ry := tx/wx, ty/wy
// We are drawing the texture src onto the window's framebuffer.
diff --git a/shiny/driver/x11driver/window.go b/shiny/driver/x11driver/window.go
index 16d9f24..97553fa 100644
--- a/shiny/driver/x11driver/window.go
+++ b/shiny/driver/x11driver/window.go
@@ -17,10 +17,10 @@
"golang.org/x/exp/shiny/driver/internal/pump"
"golang.org/x/exp/shiny/screen"
"golang.org/x/image/math/f64"
- "golang.org/x/mobile/event/config"
"golang.org/x/mobile/event/key"
"golang.org/x/mobile/event/mouse"
"golang.org/x/mobile/event/paint"
+ "golang.org/x/mobile/event/size"
"golang.org/x/mobile/geom"
)
@@ -85,7 +85,7 @@
}
w.width, w.height = newWidth, newHeight
// TODO: don't assume that PixelsPerPt == 1.
- w.Send(config.Event{
+ w.Send(size.Event{
WidthPx: newWidth,
HeightPx: newHeight,
WidthPt: geom.Pt(newWidth),
diff --git a/shiny/example/basic/main.go b/shiny/example/basic/main.go
index 673da85..29f9c9c 100644
--- a/shiny/example/basic/main.go
+++ b/shiny/example/basic/main.go
@@ -20,8 +20,8 @@
"golang.org/x/exp/shiny/driver"
"golang.org/x/exp/shiny/screen"
"golang.org/x/image/math/f64"
- "golang.org/x/mobile/event/config"
"golang.org/x/mobile/event/paint"
+ "golang.org/x/mobile/event/size"
)
func main() {
@@ -32,33 +32,33 @@
}
defer w.Release()
- size := image.Point{256, 256}
- b, err := s.NewBuffer(size)
+ winSize := image.Point{256, 256}
+ b, err := s.NewBuffer(winSize)
if err != nil {
log.Fatal(err)
}
defer b.Release()
drawGradient(b.RGBA())
- t, err := s.NewTexture(size)
+ t, err := s.NewTexture(winSize)
if err != nil {
log.Fatal(err)
}
defer t.Release()
t.Upload(image.Point{}, b, b.Bounds(), w)
- var cfg config.Event
+ var sz size.Event
for e := range w.Events() {
switch e := e.(type) {
default:
// TODO: be more interesting.
fmt.Printf("got event %#v\n", e)
- case config.Event:
- cfg = e
+ case size.Event:
+ sz = e
case paint.Event:
- wBounds := image.Rectangle{Max: image.Point{cfg.WidthPx, cfg.HeightPx}}
+ wBounds := image.Rectangle{Max: image.Point{sz.WidthPx, sz.HeightPx}}
w.Fill(wBounds, color.RGBA{0x00, 0x00, 0x3f, 0xff}, draw.Src)
w.Upload(image.Point{}, b, b.Bounds(), w)
w.Draw(f64.Aff3{