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
+8 -2
View File
@@ -8,10 +8,16 @@ import (
"errors"
)
var mainDone = make(chan struct{})
// windowCounter keeps track of the number of windows.
// A send of +1 or -1 represents a change in window count.
var windowCounter = make(chan int)
func Main() {
<-mainDone
// Wait for first window
count := <-windowCounter
for count > 0 {
count += <-windowCounter
}
}
// instead of creating files with build tags for each combination of wayland +/- x11