[SDL] Key press events

Ryan C. Gordon icculus at icculus.org
Wed Nov 1 18:13:44 PST 2006


> I'm writing a program on top of X Windows and I'm not getting any key
> press events apart from the CTRL-C.

SDL catches SIGINT (which is sent when you hit ctrl-c in the terminal 
where you launched the program) and sends an SDL_QUIT event in response 
to it, to give apps a convenient way to clean up...it makes a 
standardish Unix quit request look like they clicked the window 
manager's close button.

So I guess I'm asking: are you _sure_ the SDL window has the focus?

Also, if you're using Example 3-10, there's no SDL_Init() or 
SDL_SetVideoMode() call there...you won't get keyboard events unless 
there's a window to get events (which would also explain the ctrl-c 
thing)...use the later example code in that article.

--ryan.





More information about the SDL mailing list