Ah, fixed the stalling: logic error in the test program itself.
This commit is contained in:
parent
627abfd593
commit
214dc6cd5c
|
@ -14,34 +14,37 @@ var closeOnClick = flag.Bool("close", false, "close on click")
|
||||||
// because Cocoa hates being run off the main thread, even if it's run exclusively off the main thread
|
// because Cocoa hates being run off the main thread, even if it's run exclusively off the main thread
|
||||||
func init() {
|
func init() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
go Do(func() {
|
go func() {
|
||||||
w := NewWindow("Hello", 320, 240)
|
|
||||||
b := NewButton("There")
|
|
||||||
w.SetControl(b)
|
|
||||||
if *closeOnClick {
|
|
||||||
b.SetText("Click to Close")
|
|
||||||
}
|
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
w.OnClosing(func() bool {
|
Do(func() {
|
||||||
|
w := NewWindow("Hello", 320, 240)
|
||||||
|
b := NewButton("There")
|
||||||
|
w.SetControl(b)
|
||||||
if *closeOnClick {
|
if *closeOnClick {
|
||||||
panic("window closed normally in close on click mode (should not happen)")
|
b.SetText("Click to Close")
|
||||||
}
|
}
|
||||||
println("window close event received")
|
w.OnClosing(func() bool {
|
||||||
Stop()
|
if *closeOnClick {
|
||||||
done <- struct{}{}
|
panic("window closed normally in close on click mode (should not happen)")
|
||||||
return true
|
}
|
||||||
})
|
println("window close event received")
|
||||||
b.OnClicked(func() {
|
|
||||||
println("in OnClicked()")
|
|
||||||
if *closeOnClick {
|
|
||||||
w.Close()
|
|
||||||
Stop()
|
Stop()
|
||||||
done <- struct{}{}
|
done <- struct{}{}
|
||||||
}
|
return true
|
||||||
|
})
|
||||||
|
// GTK+ TODO: this is causing a resize event to happen afterward?!
|
||||||
|
b.OnClicked(func() {
|
||||||
|
println("in OnClicked()")
|
||||||
|
if *closeOnClick {
|
||||||
|
w.Close()
|
||||||
|
Stop()
|
||||||
|
done <- struct{}{}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
w.Show()
|
||||||
})
|
})
|
||||||
w.Show()
|
|
||||||
<-done
|
<-done
|
||||||
})
|
}()
|
||||||
err := Go()
|
err := Go()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in New Issue