emoon/minifb

Mac window disconnected from titlebar

aduros opened this issue · 2 comments

This strange bug was reported by a user on Mac: aduros/wasm4#327

screenshot

It seems to do with going in and out of fullscreen. Opening it here in case others have seen it or know any workarounds.

I'm evaluating minifb and decided to look further into this issue. I was able to duplicate this behavior on Monterey when using the Metal API. It also duplicates if I grow the window size. A build without Metal does not duplicate the issue.

As a work around, the resize control can be disabled which will also disable the full-screen window control. For my application, I'll go this route since I need to render a pixel buffer that is a fixed size.

I did some research on the behavior and think this is related to having the MTKView as the windows immediate content. Although I didn't solve it, I think if the MTKView were placed in another view or layer, the outer view would maintain the titlebar connection.

I'm afraid I don't know minifb that well across OSes to say what behavior is desired.

See https://localcoder.org/resizing-mtkview-scales-old-content-before-redraw
See https://developer.apple.com/documentation/appkit/nsstackview

Thanks for the information