mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
Bug fix: Check window.top's focus in case that game is in <iframe>
This commit is contained in:
parent
a1214ff735
commit
d933c54e20
@ -31,10 +31,11 @@ var windowIsFocused = true
|
|||||||
func init() {
|
func init() {
|
||||||
// TODO: Check IE
|
// TODO: Check IE
|
||||||
window := js.Global.Get("window")
|
window := js.Global.Get("window")
|
||||||
window.Set("onfocus", func() {
|
// Get the top window in case that this window is in an iframe.
|
||||||
|
window.Get("top").Call("addEventListener", "focus", func() {
|
||||||
windowIsFocused = true
|
windowIsFocused = true
|
||||||
})
|
})
|
||||||
window.Set("onblur", func() {
|
window.Get("top").Call("addEventListener", "blur", func() {
|
||||||
windowIsFocused = false
|
windowIsFocused = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user