hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
11.02k stars 660 forks source link

Internal log gets dumped in fullscreen mode (entering and leaving) #2850

Open venning opened 11 months ago

venning commented 11 months ago

Ebitengine Version

v2.6.2

Operating System

Go Version (go version)

go version go1.21.1 darwin/arm64

What steps will reproduce the problem?

A call to ebiten.SetFullscreen() passing either true or false.

The output will also repeat if I Alt-Tab from the fullscreen game to or from another application on the same monitor, but not a different monitor. Switching workspaces on that monitor does the same.

Test case code (Press F to toggle fullscreen in-game) go package main import ( "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/inpututil" ) type Game struct { } var fullscreen = false func (g *Game) Update() error { if inpututil.IsKeyJustPressed(ebiten.KeyF) { fullscreen = !fullscreen ebiten.SetFullscreen(fullscreen) } return nil } func (g *Game) Draw(screen *ebiten.Image) { } func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) { return 960, 540 } func main() { ebiten.SetWindowSize(960, 540) ebiten.SetWindowTitle("Fullscreen Test") ebiten.RunGame(&Game{}) }

What is the expected result?

No output to console.

What happens instead?

Something like the following message is output to console when I enter fullscreen:

1   HIToolbox                           0x00000001b16bc5c8 _ZN15MenuBarInstance22EnsureAutoShowObserverEv + 120
2   HIToolbox                           0x00000001b16bc188 _ZN15MenuBarInstance14EnableAutoShowEv + 60
3   HIToolbox                           0x00000001b16298bc _ZN15MenuBarInstance21UpdateAggregateUIModeE21MenuBarAnimationStylehhh + 1184
4   HIToolbox                           0x00000001b16bc004 _ZN15MenuBarInstance19SetFullScreenUIModeEjj + 180
5   AppKit                              0x00000001ab4b2008 -[NSApplication _setPresentationOptions:instance:flags:] + 956
6   AppKit                              0x00000001ab347bb0 -[NSApplication _updateFullScreenPresentationOptionsForInstance:] + 404
7   AppKit                              0x00000001abc0ec04 -[_NSFullScreenSpace(PresentationInstance) activateFullScreenPresentationOptions] + 148
8   AppKit                              0x00000001aba9b964 -[_NSEnterFullScreenTransitionController _doSucceededToEnterFullScreen] + 588
9   AppKit                              0x00000001aba9c264 __65-[_NSEnterFullScreenTransitionController _performEnterFullScreen]_block_invoke + 376
10  AppKit                              0x00000001ab539054 __NSFullScreenDockConnectionSendEnterForSpace_block_invoke + 168
11  libxpc.dylib                        0x00000001a7c0622c _xpc_connection_reply_callout + 124
12  libxpc.dylib                        0x00000001a7c0611c _xpc_connection_call_reply_async + 88
13  libdispatch.dylib                   0x00000001a7d0e584 _dispatch_client_callout3 + 20
14  libdispatch.dylib                   0x00000001a7d2c710 _dispatch_mach_msg_async_reply_invoke + 344
15  libdispatch.dylib                   0x00000001a7d1cc70 _dispatch_main_queue_drain + 756
16  libdispatch.dylib                   0x00000001a7d1c96c _dispatch_main_queue_callback_4CF + 44
17  CoreFoundation                      0x00000001a7fb5d50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
18  CoreFoundation                      0x00000001a7f737d0 __CFRunLoopRun + 2036
19  CoreFoundation                      0x00000001a7f72888 CFRunLoopRunSpecific + 612
20  HIToolbox                           0x00000001b1647fa0 RunCurrentEventLoopInMode + 292
21  HIToolbox                           0x00000001b1647de4 ReceiveNextEventCommon + 672
22  HIToolbox                           0x00000001b1647b2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
23  AppKit                              0x00000001ab1f4424 _DPSNextEvent + 632
24  AppKit                              0x00000001ab1f35b4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
25  main                                0x0000000104f6ca20 _glfwPlatformPollEvents + 112
26  main                                0x0000000104d9fb7c runtime.asmcgocall.abi0 + 124

Here's a workspace change on that monitor:

1   HIToolbox                           0x00000001b16bc5c8 _ZN15MenuBarInstance22EnsureAutoShowObserverEv + 120
2   HIToolbox                           0x00000001b165f27c SetMenuBarObscured + 224
3   HIToolbox                           0x00000001b165eee8 _ZN13HIApplication15HandleActivatedEP14OpaqueEventRefhP15OpaqueWindowPtrh + 172
4   HIToolbox                           0x00000001b1658fcc _ZN13HIApplication13EventObserverEjP14OpaqueEventRefPv + 296
5   HIToolbox                           0x00000001b161fcd0 _NotifyEventLoopObservers + 176
6   HIToolbox                           0x00000001b165896c AcquireEventFromQueue + 432
7   HIToolbox                           0x00000001b1647c84 ReceiveNextEventCommon + 320
8   HIToolbox                           0x00000001b1647b2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
9   AppKit                              0x00000001ab1f4424 _DPSNextEvent + 632
10  AppKit                              0x00000001ab1f35b4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
11  main                                0x0000000100eb4a14 _glfwPlatformPollEvents + 164
12  main                                0x0000000100ce7aec runtime.asmcgocall.abi0 + 124

Anything else you feel useful to add?

macOS Ventura 13.1 Apple M1 Pro; 14-inch, 2021

hajimehoshi commented 11 months ago

Does this cause crashes?

venning commented 11 months ago

No crashes. I notice no unusual behavior except for the console logs.

Edit: If I wasn't clear in my original post, multiple actions like entering/exiting fullscreen or switching workspaces will result in additional outputs to the console.

venning commented 10 months ago

A new addition to the logs:

2024-01-01 05:02:00.660 proc[77893:5775086] IMKClient Stall detected, *please Report* your user scenario attaching a spindump (or sysdiagnose) that captures the problem - (imkxpc_bundleIdentifierWithReply:) block performed very slowly (1.01 secs).