So I have the following code that listens for a keydown event and then exits as soon as it receives one:
int main(int argc, char** argv) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface* screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF);
SDL_Event _event;
while (1) {
while (SDL_PollEvent(&_event)) {
if (_event.type == SDL_KEYDOWN) {
return 0;
}
}
SDL_GL_SwapBuffers();
}
}
When I run it, I can press any arrow key, letter, number, F1-F12... pretty much any key except for the left control key, and the program will exit instantly.
But when I press the left control key, the program doesn't exit until I release the key.
And although the example doesn't show it, pressing another key while left-control is being held down (eg ctrl+s) causes the missing control keydown event to be triggered (along with a second event that says 's' was pressed).
Is there any way to disable this strange behavior for the left-control key?
Btw, this is on Windows using mingw. I haven't tested this behavior with any other compilers/operating systems.