From c5bff7b0027e1daffd3dbfd6e7c22f94463d5e4c Mon Sep 17 00:00:00 2001 From: faiface Date: Sat, 19 Aug 2017 17:21:03 +0200 Subject: win: clean up mainthread event handling --- win/win.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'win/win.go') diff --git a/win/win.go b/win/win.go index 82637f1..0b34ee1 100644 --- a/win/win.go +++ b/win/win.go @@ -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) }) -- cgit v1.2.3