Commit Graph

5 Commits

Author SHA1 Message Date
David Crawshaw 9cc656ecd6 app: darwin/amd64 event model implementation
Change-Id: I16d706131508bd27415f26c6bbb64210e0af2819
Reviewed-on: https://go-review.googlesource.com/11620
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-27 19:19:22 +00:00
David Crawshaw 068a51c195 gl: batch calls onto a dedicated context thread
All GL function calls fill out a C.struct_fnargs and drop it on the
work queue. The Start function drains the work queue and hands
over a batch of calls to C.process which runs them. This allows
multiple GL calls to be executed in a single cgo call.

A GL call is marked as blocking if it returns a value, or if it
takes a Go pointer. In this case the call will not return until
C.process sends a value on the retvalue channel.

Change-Id: I4c76b2a8ad55f57b0c98d200d0fb708d4634e042
Reviewed-on: https://go-review.googlesource.com/10452
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-01 15:35:03 +00:00
David Crawshaw 5cddc1460e app: introduce Config and start registration
Config provides a way to concurrently access Width and Height.

Register provides a way for packages to run code on app state change
without plumbing changes all the way to the process main function.
This is motivated by gl/glutil.Image which needs to rebuild its
textures on start/stop and can be deeply nested.
(See golang.org/cl/9707 for the followup.)

Tested manually on android and darwin/amd64. Doing this kind makes it
clear any CL modifying this code needs a lot of manual testing right
now, so some kind of trybot support is something I'm going to
prioritise.

Fixes golang/go#10686
Fixes golang/go#10461
Fixes golang/go#10442
Fixes golang/go#10226
Updates golang/go#10327

Change-Id: I2882ebf3995b6ed857cda823e94fbb17c54b43a8
Reviewed-on: https://go-review.googlesource.com/9708
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-06 17:32:53 +00:00
Gordon Klaus 253eb63b86 mobile/app: identify touches by ID to enable multitouch
An example of how to handle multiple concurrent touches using this design:

var touched = map[event.TouchSequenceID]*Widget{}
func touch(t event.Touch) {
    if t.Type == event.TouchStart {
        if w := widgetAt(t.Loc); w != nil {
            touched[t.ID] = w
        }
    }
    if w, ok := touched[t.ID]; ok {
         // move/scroll widget, etc
    }
    if t.Type == event.TouchEnd {
        delete(touched, t.ID)
    }
}

Change-Id: I79910ef30abe9a41bc0720783022b1af081fbd43
Reviewed-on: https://go-review.googlesource.com/1895
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Burcu Dogan <jbd@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-29 16:53:16 +00:00
David Crawshaw 67dbb30552 app: basic darwin/arm support
Still needs some geometry adjustments, coming in a followup CL.

Change-Id: If1298a0deef117ee635db1af78fb743a60a8c8d5
Reviewed-on: https://go-review.googlesource.com/5480
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-23 15:45:04 +00:00