ui: Bug fix: userInterface.fullscreen() must be called from the main thread

This commit is contained in:
Hajime Hoshi 2018-02-24 18:10:39 +09:00
parent b58dc26832
commit 78a58fd1ae

View File

@ -247,6 +247,7 @@ func ScreenScale() float64 {
return s return s
} }
// fullscreen must be called from the main thread.
func (u *userInterface) fullscreen() bool { func (u *userInterface) fullscreen() bool {
if !u.isRunning() { if !u.isRunning() {
panic("not reached") panic("not reached")
@ -259,7 +260,12 @@ func IsFullscreen() bool {
if !u.isRunning() { if !u.isRunning() {
return u.isInitFullscreen() return u.isInitFullscreen()
} }
return u.fullscreen() b := false
_ = u.runOnMainThread(func() error {
b = u.fullscreen()
return nil
})
return b
} }
func SetFullscreen(fullscreen bool) { func SetFullscreen(fullscreen bool) {