[SDL] Cocoa window menus in 1.3
Sam Lantinga
slouken at devolution.com
Sun Jul 30 10:12:44 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".
So I left the menus there, but disabled keyboard shortcuts. The SDL
event loop eats key events so they don't cause beeps. I've tried several
different approaches to stop the beeping, but I haven't found anything
that works yet.
> 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.
I'm not sure exactly what you mean by "physical keycode" support. The
intended behavior is that the SDL keysym reflects the unshifted keys
printed on the keyboard (the key layout). This allows the key layouts
presented to the user to make sense with with what they see on the keyboard.
If you always want the same physical key layout, regardless of the type of
keyboard, you should use the hardware dependent scancodes directly, which
is why they're available.
See ya,
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment
More information about the SDL
mailing list