remove last usages of mainthread.CallVal

This commit is contained in:
faiface 2017-03-15 23:43:00 +01:00
parent cd11c39e64
commit 311b474e89
1 changed files with 14 additions and 9 deletions

View File

@ -195,9 +195,11 @@ func (w *Window) SetClosed(closed bool) {
// //
// The closed flag is automatically set when a user attempts to close the Window. // The closed flag is automatically set when a user attempts to close the Window.
func (w *Window) Closed() bool { func (w *Window) Closed() bool {
return mainthread.CallVal(func() interface{} { var closed bool
return w.window.ShouldClose() mainthread.Call(func() {
}).(bool) closed = w.window.ShouldClose()
})
return closed
} }
// SetTitle changes the title of the Window. // SetTitle changes the title of the Window.
@ -290,9 +292,10 @@ func (w *Window) IsFullscreen() bool {
// Monitor returns a monitor the Window is fullscreen on. If the Window is not fullscreen, this // Monitor returns a monitor the Window is fullscreen on. If the Window is not fullscreen, this
// function returns nil. // function returns nil.
func (w *Window) Monitor() *Monitor { func (w *Window) Monitor() *Monitor {
monitor := mainthread.CallVal(func() interface{} { var monitor *glfw.Monitor
return w.window.GetMonitor() mainthread.Call(func() {
}).(*glfw.Monitor) monitor = w.window.GetMonitor()
})
if monitor == nil { if monitor == nil {
return nil return nil
} }
@ -310,9 +313,11 @@ func (w *Window) Focus() {
// Focused returns true if the Window has input focus. // Focused returns true if the Window has input focus.
func (w *Window) Focused() bool { func (w *Window) Focused() bool {
return mainthread.CallVal(func() interface{} { var focused bool
return w.window.GetAttrib(glfw.Focused) == glfw.True mainthread.Call(func() {
}).(bool) focused = w.window.GetAttrib(glfw.Focused) == glfw.True
})
return focused
} }
// Maximize puts the Window to the maximized state. // Maximize puts the Window to the maximized state.