[SDL] Well, me again having problems with the Key Events...

Doug biteme at bitbasher.net
Tue Jun 12 22:21:03 PDT 2007


In article <466F5025.8090600 at yahoo.com.ar>, manugarciac5 at yahoo.com.ar 
says...
>Let me explain what I'm doing. I'm doing a VNC client. I have two
>threads, one that is constantly showing images that are received from
>the net, and other that is constantly looking for mouse and keyboard
>events (quit events too, of course). Well, I can show you the code in
>the events thread, but I don't see how it would help. If I put a printf
>inside the case SDL_KEYDOWN it prints even when I released the key...

Your code may help.  You've shown us only three lines of a sample switch 
statement.  Your problem could possibly be as simple as a missing break 
statement on a case clause causing the execution to pass through into 
another case clause unintentionally.

Also, what platform is this?  Win32?  Linux?  Other?

Further, I don't know all the ins and out of this issue, but there are 
certain SDL things you simply cannot do in another thread.  Certain SDL 
functions must be called in and only in the main thread.  I'm not sure if 
there's a list, but using *some* SDL functions in different threads can 
cause issues as SDL is not 100% thread safe.

Doug.




More information about the SDL mailing list