• Sam Lantinga's avatar
    Date: Mon, 6 Feb 2006 11:41:04 -0500 · fc0f66b5
    Sam Lantinga authored
    From: "mystml@adinet.com.uy"
    Subject: [SDL] ALT-F4 using DirectX
    
    My game isn't getting SDL_QUIT when I press ALT-F4 using the DirectX
    driver; it does get SDL_QUIT when I press the red X in the window.
    
    I tracked this down to DX5_HandleMessage() in SDL_dx5events.c;
    WM_SYSKEYDOWN is being trapped and ignored which causes Windows not to post
    a WM_CLOSE, hence no SDL_QUIT is being generated.
    
    The relevant code is this :
    
                    /* The keyboard is handled via DirectInput */
                    case WM_SYSKEYUP:
                    case WM_SYSKEYDOWN:
                    case WM_KEYUP:
                    case WM_KEYDOWN: {
                            /* Ignore windows keyboard messages */;
                    }
                    return(0);
    
    If I comment the WM_SYSKEYDOWN case, it falls through DefWindowProc() and
    ALT-F4 starts working again.
    
    I'm not sure about the best way to fix this. One option is handling ALT-F4
    as a particular case somehow, but doesn't sound good. Another option would
    be to handle WM_SYSKEYDOWN separately and breaking instead of returning 0,
    so processing falls through and goes to DefWindowProc which does The Right
    Thing (TM). This seems to be the minimal change that makes ALT-F4 work and
    normal keyboard input continues to work.
    
    Does this sound reasonable? Am I overlooking anything? Do I submit a patch?
    
    --Gabriel
    
    --HG--
    extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401352
    fc0f66b5
Name
Last commit
Last update
..
Xext Loading commit data...
aalib Loading commit data...
ataricommon Loading commit data...
bwindow Loading commit data...
cybergfx Loading commit data...
dc Loading commit data...
dga Loading commit data...
directfb Loading commit data...
dummy Loading commit data...
epoc Loading commit data...
fbcon Loading commit data...
gapi Loading commit data...
gem Loading commit data...
ggi Loading commit data...
ipod Loading commit data...
maccommon Loading commit data...
macdsp Loading commit data...
macrom Loading commit data...
nanox Loading commit data...
os2fslib Loading commit data...
photon Loading commit data...
picogui Loading commit data...
ps2gs Loading commit data...
qtopia Loading commit data...
quartz Loading commit data...
riscos Loading commit data...
svga Loading commit data...
vgl Loading commit data...
wincommon Loading commit data...
windib Loading commit data...
windx5 Loading commit data...
wscons Loading commit data...
x11 Loading commit data...
xbios Loading commit data...
.cvsignore Loading commit data...
Makefile.am Loading commit data...
Makefile.wat Loading commit data...
SDL_RLEaccel.c Loading commit data...
SDL_RLEaccel_c.h Loading commit data...
SDL_blit.c Loading commit data...
SDL_blit.h Loading commit data...
SDL_blit_0.c Loading commit data...
SDL_blit_1.c Loading commit data...
SDL_blit_A.c Loading commit data...
SDL_blit_N.c Loading commit data...
SDL_bmp.c Loading commit data...
SDL_cursor.c Loading commit data...
SDL_cursor_c.h Loading commit data...
SDL_gamma.c Loading commit data...
SDL_glfuncs.h Loading commit data...
SDL_leaks.h Loading commit data...
SDL_pixels.c Loading commit data...
SDL_pixels_c.h Loading commit data...
SDL_stretch.c Loading commit data...
SDL_stretch_c.h Loading commit data...
SDL_surface.c Loading commit data...
SDL_sysvideo.h Loading commit data...
SDL_video.c Loading commit data...
SDL_yuv.c Loading commit data...
SDL_yuv_mmx.c Loading commit data...
SDL_yuv_sw.c Loading commit data...
SDL_yuv_sw_c.h Loading commit data...
SDL_yuvfuncs.h Loading commit data...
blank_cursor.h Loading commit data...
default_cursor.h Loading commit data...
e_log.h Loading commit data...
e_pow.h Loading commit data...
e_sqrt.h Loading commit data...
math_private.h Loading commit data...
mmx.h Loading commit data...