mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-09-19 21:02:18 +02:00
internal/ui: bug fix: hiding a window decoration at initialization doesn't work on macOS
Closes #2600
This commit is contained in:
parent
3bcac70d1c
commit
1656c47abf
@ -112,6 +112,7 @@ type userInterfaceImpl struct {
|
|||||||
framebufferSizeCallbackCh chan struct{}
|
framebufferSizeCallbackCh chan struct{}
|
||||||
|
|
||||||
glContextSetOnce sync.Once
|
glContextSetOnce sync.Once
|
||||||
|
darwinInitOnce sync.Once
|
||||||
|
|
||||||
mainThread threadInterface
|
mainThread threadInterface
|
||||||
renderThread threadInterface
|
renderThread threadInterface
|
||||||
@ -810,11 +811,14 @@ event:
|
|||||||
func (u *userInterfaceImpl) initOnMainThread(options *RunOptions) error {
|
func (u *userInterfaceImpl) initOnMainThread(options *RunOptions) error {
|
||||||
glfw.WindowHint(glfw.AutoIconify, glfw.False)
|
glfw.WindowHint(glfw.AutoIconify, glfw.False)
|
||||||
|
|
||||||
decorated := glfw.False
|
// On macOS, window decoration should be initialized once after buffers are swapped (#2600).
|
||||||
if u.isInitWindowDecorated() {
|
if runtime.GOOS != "darwin" {
|
||||||
decorated = glfw.True
|
decorated := glfw.False
|
||||||
|
if u.isInitWindowDecorated() {
|
||||||
|
decorated = glfw.True
|
||||||
|
}
|
||||||
|
glfw.WindowHint(glfw.Decorated, decorated)
|
||||||
}
|
}
|
||||||
glfw.WindowHint(glfw.Decorated, decorated)
|
|
||||||
|
|
||||||
glfwTransparent := glfw.False
|
glfwTransparent := glfw.False
|
||||||
if options.ScreenTransparent {
|
if options.ScreenTransparent {
|
||||||
@ -901,7 +905,10 @@ func (u *userInterfaceImpl) initOnMainThread(options *RunOptions) error {
|
|||||||
_ = u.skipTaskbar()
|
_ = u.skipTaskbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
u.window.Show()
|
// On macOS, the window is shown once after buffers are swapped at update.
|
||||||
|
if runtime.GOOS != "darwin" {
|
||||||
|
u.window.Show()
|
||||||
|
}
|
||||||
|
|
||||||
if g, ok := u.graphicsDriver.(interface{ SetWindow(uintptr) }); ok {
|
if g, ok := u.graphicsDriver.(interface{ SetWindow(uintptr) }); ok {
|
||||||
g.SetWindow(u.nativeWindow())
|
g.SetWindow(u.nativeWindow())
|
||||||
@ -982,6 +989,20 @@ func (u *userInterfaceImpl) update() (float64, float64, error) {
|
|||||||
u.setInitFullscreen(false)
|
u.setInitFullscreen(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if runtime.GOOS == "darwin" && u.bufferOnceSwapped {
|
||||||
|
u.darwinInitOnce.Do(func() {
|
||||||
|
// On macOS, window decoration should be initialized once after buffers are swapped (#2600).
|
||||||
|
decorated := glfw.False
|
||||||
|
if u.isInitWindowDecorated() {
|
||||||
|
decorated = glfw.True
|
||||||
|
}
|
||||||
|
u.window.SetAttrib(glfw.Decorated, decorated)
|
||||||
|
|
||||||
|
// The window is not shown at the initialization on macOS. Show the window here.
|
||||||
|
u.window.Show()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user