mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/glfw: bug fix: the window should be focused when closing is handled
Closes #2165
This commit is contained in:
parent
dd292552d5
commit
bc8e2fe6ac
@ -105,6 +105,10 @@ func (w *Window) Destroy() {
|
||||
theWindows.remove(w.w)
|
||||
}
|
||||
|
||||
func (w *Window) Focus() {
|
||||
w.w.Focus()
|
||||
}
|
||||
|
||||
func (w *Window) GetAttrib(attrib Hint) int {
|
||||
return w.w.GetAttrib(glfw.Hint(attrib))
|
||||
}
|
||||
|
@ -66,6 +66,12 @@ func (w *Window) Destroy() {
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Window) Focus() {
|
||||
if err := (*glfwwin.Window)(w).Focus(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Window) GetAttrib(attrib Hint) int {
|
||||
r, err := (*glfwwin.Window)(w).GetAttrib(glfwwin.Hint(attrib))
|
||||
if err != nil {
|
||||
@ -74,12 +80,6 @@ func (w *Window) GetAttrib(attrib Hint) int {
|
||||
return r
|
||||
}
|
||||
|
||||
func (w *Window) SetAttrib(attrib Hint, value int) {
|
||||
if err := (*glfwwin.Window)(w).SetAttrib(glfwwin.Hint(attrib), value); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Window) GetCursorPos() (x, y float64) {
|
||||
x, y, err := (*glfwwin.Window)(w).GetCursorPos()
|
||||
if err != nil {
|
||||
@ -166,6 +166,12 @@ func (w *Window) Restore() {
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Window) SetAttrib(attrib Hint, value int) {
|
||||
if err := (*glfwwin.Window)(w).SetAttrib(glfwwin.Hint(attrib), value); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Window) SetCharModsCallback(cbfun CharModsCallback) (previous CharModsCallback) {
|
||||
f, err := (*glfwwin.Window)(w).SetCharModsCallback(cbfun)
|
||||
if err != nil {
|
||||
|
@ -780,6 +780,7 @@ func (u *userInterfaceImpl) registerWindowCloseCallback() {
|
||||
if !u.isWindowClosingHandled() {
|
||||
return
|
||||
}
|
||||
u.window.Focus()
|
||||
u.window.SetShouldClose(false)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user