mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +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() {
|
||||
// TODO: Check IE
|
||||
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
|
||||
})
|
||||
window.Set("onblur", func() {
|
||||
window.Get("top").Call("addEventListener", "blur", func() {
|
||||
windowIsFocused = false
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user