[SDL] Cocoa window menus in 1.3

Christian Walther cwalther at gmx.ch
Sat Jul 29 23:37:06 PDT 2006


Sam Lantinga wrote:
> I have a nib-less SDLmain-less Cocoa setup in SDL 1.3, and I'm implementing
> keyboard support now.  However, as soon as I take full control over the key
> input, the window shortcuts in the menu will no longer work.
> 
> So my question is, should I put up a window menu for the default SDL app?

Seems like a good idea to me. It can be useful, most Mac OS X 
applications have one, and even if it's not used it doesn't hurt. In 
fact, SDL 1.2 has it too, and I've never heard anyone complain about it, 
even though it's not terribly useful in single-window apps.

> Should it respond to the keyboard shortcuts?  Should it also pass those
> keys to the application?

That's a more difficult question. It certainly shouldn't eat away key 
events before they reach the application. My preferred solution would be 
that only events that the application decides not to handle would be 
passed on to the OS for processing as menu shortcuts. Maybe an 
SDL_PassEvent(event) function or something. I could also live with the 
way things work in SDL 1.2, though, i.e. keyboard shortcuts don't work 
unless the application interprets them itself "by hand".


By the way, speaking of keyboard support in SDL 1.3: I've long planned 
to write up a prototype implementation (for Cocoa and X11) of the 
"physical keycode" support I've been whining about for a while before 
the 1.3 API is finalized. However, I haven't got very far with it yet, 
and since I don't have much spare time currently I'll probably be late. 
Can you provide an estimate of the timeframe in which you'd still be 
willing to accept additions to the API currently defined in 
SDL_keyboard.h/SDL_keysym.h? (If you're willing to accept them at all, 
that is, and of course the thing would have to go through public 
scrutiny before being integrated.)

  -Christian





More information about the SDL mailing list