[SDL] Alt-F4 not working on Windows

Sami Näätänen sn.ml at bayminer.com
Fri May 2 03:03:43 PDT 2008


On Thursday 01 May 2008, Will Langford wrote:
> > On Wed, Apr 30, 2008 at 6:49 PM, Mason Wheeler 
<masonwheeler at yahoo.com> wrote:
> > > <ALT>-<F4> is a Windows standard.  It always means "quit" on
> > > every program.
>
> While I'm not a majorly active developer in SDL at the moment, nor
> very active in the mailing lists... I wouldn't mind throwing my two
> cents into this foray.
>
> Synopsis: this doesn't belong in SDL... much like many of the other
> 'why doesnt SDL do foo?' requests that penetrate beyond the 'SIMPLE'
> part of the SDL name.  If there's a desire for a nice global 'catch
> all common program termination keyboard combinations', I'd suggest
> the creation of SDL_quit library or similar.
>
> Clicking on the lil X, red circle, etc etc etc, causes the window
> manager or similar to give SDL an eventual SDL_QUIT message.  It's
> therefore up to window manager to signal the 'please close'.
>
> I've played plenty of games under windows where ALT-F4 doesn't close
> the game.  And in my humble opinion it shouldn't.  Granted, ALT-F4 is
> a strange keyboard combination, but what if it was plausible to bind
> something as such ?  Similar to CTRL-number, ALT-number, etc.
>
> If ALT-F4 is supposed to generate an SDL_QUIT under windows, then
> what about lining up code that generates an SDL_QUIT via some
> automagical window manager / OS detection routine and associated
> keyboard combinations ?  And what if I wanted to make any of those
> given key combinations usable within my application rather than force
> a program close ?

I'm with You and Bob Bendleton here. SDL should not restrict the 
keyboard usage on certain platforms, because it will break portability.

SDL could have something like
SDL_EnableOSShortCuts( int bool )
to allow easy to use compatibility layer for those who want to enable 
these OS specific keyboard events.



More information about the SDL mailing list