[SDL] Alt-F4 not working on Windows

Bill Kendrick nbs at sonic.net
Fri May 2 09:18:17 PDT 2008


On Fri, May 02, 2008 at 08:26:49AM -0500, Bob Pendleton wrote:
>    BTW, having alt-f4 terminate a program (cleanly or not) is not a
>    fundamental human right. It is a windows convention. A convention that can
>    be ignored and often is ignored, by developers and users.

Here is, I think, the problem.

On my KDE desktop, ALT+F4 closes windows.
One of my SDL games, which doesn't listen for 'Alt' plus 'F4' keystrokes,
quits when I hit ALT+F4.  Obviously, it's reacting to the KDE window manager,
just as though I had clicked the "X" button in the title bar, asked KDE to
log me out, right-clicked the window in my taskbar and selected 'Close', etc.

Apparently in Windows, ALT+F4 is NOT handled by the window management
level, and is simply passed along to the application.  So SDL doesn't
_specifically_ listen for this (it doesn't have to listen for ALT+F4 in KDE,
it just gets a 'window is being asked to close' event, just like clicking "X").

So the question is: do we ADD functionality to SDL to listen for ALT+F4,
on Windows (the oddity here), and pass along SDL_QUIT to the event queue?

If we DO, then we certainly need to make it _optional_, since many games
and apps may want full-control.  (I guess they're out of luck under
window managers like KWin, unless the user changes their WM shortcuts.)

And in that case, what's the default behavior?  Traditional?  (Pass ALT+F4
to the event queue as keypresses.)  Or 'helper' (send SDL_QUIT)?
To prevent a religious war, I suggest default remains traditional.

And, btw... WOW.  What a thread. :)

-bill!


More information about the SDL mailing list