app/internal/window: block Main until all windows are closed

With this change, the Wayland backend now supports multiple windows.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-05-15 16:43:27 +02:00
parent cf72e684b6
commit 0181f22d01
3 changed files with 19 additions and 4 deletions
+6 -1
View File
@@ -179,13 +179,18 @@ func newWLWindow(window Callbacks, opts *Options) error {
d.destroy()
return err
}
// Increment window counter.
windowCounter <- +1
w.w = window
go func() {
defer func() {
// Decrement window counter.
windowCounter <- -1
}()
w.w.SetDriver(w)
w.loop()
w.destroy()
d.destroy()
close(mainDone)
}()
return nil
}