diff options
| author | faiface <faiface@ksp.sk> | 2017-08-19 17:21:03 +0200 |
|---|---|---|
| committer | faiface <faiface@ksp.sk> | 2017-08-19 17:21:03 +0200 |
| commit | c5bff7b0027e1daffd3dbfd6e7c22f94463d5e4c (patch) | |
| tree | 6b7311f6b1a9c99678f8fb09fb954099d38d1f20 /win/win.go | |
| parent | 5c03b55810df3cb1d2a15324fea05f5efeab262c (diff) | |
| download | gui-c5bff7b0027e1daffd3dbfd6e7c22f94463d5e4c.zip | |
win: clean up mainthread event handling
Diffstat (limited to 'win/win.go')
| -rw-r--r-- | win/win.go | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -61,16 +61,16 @@ func New(opts ...Option) (*Win, error) { return nil, err } - events := make(chan string) + w.mainthreadEvents = make(chan string) mainthread.Call(func() { w.resize(o.width, o.height) - w.setUpEvents(events) + w.setUpMainthreadEvents() }) go func() { for { select { - case event := <-events: + case event := <-w.mainthreadEvents: w.Dispatch.Happen(event) case <-w.closed: return @@ -114,9 +114,10 @@ func makeGLFWWin(o *options) (*glfw.Window, error) { type Win struct { event.Dispatch - w *glfw.Window - rgba *image.RGBA - closed chan struct{} + w *glfw.Window + rgba *image.RGBA + mainthreadEvents chan string + closed chan struct{} } func (w *Win) Close() error { @@ -130,7 +131,6 @@ func (w *Win) Image() *image.RGBA { var curWin *Win = nil func (w *Win) Flush(r image.Rectangle) { - w.Dispatch.Happen(mkEvent("wi", "flush", r.Min.X, r.Min.Y, r.Max.X, r.Max.Y)) mainthread.Call(func() { w.flush(r) }) |