event/size: make methods take values, not pointers.
This makes the following program valid:
----
package main
import (
"fmt"
"golang.org/x/mobile/event/size"
)
func foo() size.Event { return size.Event{} }
func main() {
fmt.Println(foo().Bounds())
}
----
Previously, you would get:
./main.go:12: cannot call pointer method on foo()
./main.go:12: cannot take the address of foo()
Change-Id: I2801d18a04d56d1c7496cb008531d078490ccf86
Reviewed-on: https://go-review.googlesource.com/18356
Reviewed-by: David Crawshaw <crawshaw@golang.org>
diff --git a/event/size/size.go b/event/size/size.go
index 6186af2..d9820c3 100644
--- a/event/size/size.go
+++ b/event/size/size.go
@@ -38,7 +38,7 @@
// Size returns the window's size in pixels, at the time this size event was
// sent.
-func (e *Event) Size() image.Point {
+func (e Event) Size() image.Point {
return image.Point{e.WidthPx, e.HeightPx}
}
@@ -47,7 +47,7 @@
//
// The top-left pixel is always (0, 0). The bottom-right pixel is given by the
// width and height.
-func (e *Event) Bounds() image.Rectangle {
+func (e Event) Bounds() image.Rectangle {
return image.Rectangle{Max: image.Point{e.WidthPx, e.HeightPx}}
}