mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-04 15:04:28 +01:00
internal/uidriver/glfw: Bug fix: Disable the sticky mode on FPSModeVsyncOffMinimum
Closes #1791
This commit is contained in:
parent
0e5dca9453
commit
d5ce0dbd90
@ -617,7 +617,7 @@ func (u *UserInterface) SetFPSMode(mode driver.FPSMode) {
|
|||||||
u.m.Unlock()
|
u.m.Unlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
u.fpsMode = mode
|
u.setFPSMode(mode)
|
||||||
u.updateVsync()
|
u.updateVsync()
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@ -752,8 +752,6 @@ func (u *UserInterface) createWindow() error {
|
|||||||
u.window.MakeContextCurrent()
|
u.window.MakeContextCurrent()
|
||||||
}
|
}
|
||||||
|
|
||||||
u.window.SetInputMode(glfw.StickyMouseButtonsMode, glfw.True)
|
|
||||||
u.window.SetInputMode(glfw.StickyKeysMode, glfw.True)
|
|
||||||
u.window.SetInputMode(glfw.CursorMode, driverCursorModeToGLFWCursorMode(u.getInitCursorMode()))
|
u.window.SetInputMode(glfw.CursorMode, driverCursorModeToGLFWCursorMode(u.getInitCursorMode()))
|
||||||
u.window.SetCursor(glfwSystemCursors[u.getCursorShape()])
|
u.window.SetCursor(glfwSystemCursors[u.getCursorShape()])
|
||||||
u.window.SetTitle(u.title)
|
u.window.SetTitle(u.title)
|
||||||
@ -950,6 +948,19 @@ func (u *UserInterface) updateSize() (float64, float64, bool) {
|
|||||||
return w, h, true
|
return w, h, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setFPSMode must be called from the main thread.
|
||||||
|
func (u *UserInterface) setFPSMode(fpsMode driver.FPSMode) {
|
||||||
|
u.fpsMode = fpsMode
|
||||||
|
u.fpsModeInited = true
|
||||||
|
|
||||||
|
sticky := glfw.True
|
||||||
|
if fpsMode == driver.FPSModeVsyncOffMinimum {
|
||||||
|
sticky = glfw.False
|
||||||
|
}
|
||||||
|
u.window.SetInputMode(glfw.StickyMouseButtonsMode, sticky)
|
||||||
|
u.window.SetInputMode(glfw.StickyKeysMode, sticky)
|
||||||
|
}
|
||||||
|
|
||||||
// update must be called from the main thread.
|
// update must be called from the main thread.
|
||||||
func (u *UserInterface) update() (float64, float64, bool, error) {
|
func (u *UserInterface) update() (float64, float64, bool, error) {
|
||||||
if u.err != nil {
|
if u.err != nil {
|
||||||
@ -969,8 +980,7 @@ func (u *UserInterface) update() (float64, float64, bool, error) {
|
|||||||
// Initialize vsync after SetMonitor is called. See the comment in updateVsync.
|
// Initialize vsync after SetMonitor is called. See the comment in updateVsync.
|
||||||
// Calling this inside setWindowSize didn't work (#1363).
|
// Calling this inside setWindowSize didn't work (#1363).
|
||||||
if !u.fpsModeInited {
|
if !u.fpsModeInited {
|
||||||
u.fpsMode = u.getInitFPSMode()
|
u.setFPSMode(u.getInitFPSMode())
|
||||||
u.fpsModeInited = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call updateVsync even though fpsMode is not updated.
|
// Call updateVsync even though fpsMode is not updated.
|
||||||
|
Loading…
Reference in New Issue
Block a user