How to get working menu bar in SDL2 MacOSX app?

Hi all. I’m new to SDL2 and so far have built all the demo programs on OS X Sierra under Xcode 8.3.2. I’ve also built a small single-window test program of my own.

In all of these programs, the Mac menu bar is “dead”. I see an application menu, and “Window” and “View” menus, at the top of the screen, but clicking in them does nothing. No menus appear; I can’t select anything, etc.

Is there any easy way to fix this? I’ve googled and found some hacks for an old SDL1 version of SDLmain.m, but these do not seem relevant to SDL2. Before I go off on a code adventure of my own, I’d like to see if there’s a known solution first.

Thanks to all.

Tim DeBenedictis
Southern Stars Group, LLC

OK, more on this. I’ve just discovered that if I put my SDL2 Mac apps in the background, then move them to the foreground, then the menu bar becomes active. This is 100% reproducible for me with the “drawchessboard” and “testdraw2” SDL test apps. So now I’m thinking that this is a bug.

Is this reproducible for anyone besides me?

Yes. Reproduced with testgl2 and current SDL2 hg. I just Cmd+Tab to Xcode, then Cmd+Tab back to testgl2 to get the menu to work.

OK … good to know I’m not crazy. So … how do we fix this bug? Without going too crazy?

This may be the same bug:
https://bugzilla.libsdl.org/show_bug.cgi?id=3051

It sounds like the issue is in macOS, and happens when an application is standalone executable, not an .app bundle?

I think these bugs may indeed be related. However, I’'ve found that I can create single-window apps using GLFW that do not have any of these problems. They are also command-line apps without any kind of app bundle. Just like SDL, GLFW creates a minimal menu bar. But unlike SDL, the GLFW app’s menu bar is fully functional. So, I think the path to fixing this involves looking at how GLFW creates its minimal menu bar (and handles events in it.) FYI, I’ve switched over to developing on GLFW because of this issue - it’s a showstopper for me. I’d be happy to consider switching back to SDL if this problem can be solved. http://www.glfw.org