Strange keyboard problem

Hi all!

I have a weird problem with the keyboard (linux, SDL+sge library).
Sometimes, but not always, the return key is no longer responding when I
start my program for the second time (I can always run it once without a
problem). Usually in this case I get lots of “returns” in the shell from
which I started the program after leaving it. Then it is not sufficient to
kill the X server, I have to reboot the machine to get rid of this problem!
I have not yet figured out under which conditions this happens, it seems
rather random. The question is whether this is a problem with SDL or (maybe
a typical) mistake in my program.

More specific, my program looks as follows: I’m using DGA
(SDL_VIDEODRIVER=dga, flags are: SDL_HWSURFACE|SDL_FULLSCREEN
SDL_DOUBLEBUF) - this all works fine.
I have a global event loop and a timer that does the graphics update. The
keyboard event are read in the usual fashion:

while( SDL_PollEvent( &event ) ) {
switch( event.type ) {
case SDL_KEYDOWN:
if(event.key.keysym.sym == SDLK_ESCAPE) {

So nothing unusual here, I think. Anyone a clue?

Matthias

Hi all!

I have a weird problem with the keyboard (linux, SDL+sge library).
Sometimes, but not always, the return key is no longer responding when I
start my program for the second time (I can always run it once without a
problem). Usually in this case I get lots of “returns” in the shell from
which I started the program after leaving it. Then it is not sufficient to
kill the X server, I have to reboot the machine to get rid of this problem!
I have not yet figured out under which conditions this happens, it seems
rather random. The question is whether this is a problem with SDL or (maybe

sounds like a focus problem… prehaps a X misconfiguration/bug, or
prehaps an improper shutdown of some sort. How are you qutting? What
version of SDL (and for that matter, XFree, or whatever X server you’re
running) are you using? You might try exiting by intentional segfault
(or prehaps simply sending a signal) to trip the SDL parachute, and see
if the problem goes away when you do so. Are you sure you’re calling
SDL_Quit in all the right places?

All the troubleshooting I can think of right off the top of my head.

-Mike

Hi,

many thanks for the response, Mike!

sounds like a focus problem… prehaps a X misconfiguration/bug, or
prehaps an improper shutdown of some sort. How are you qutting? What
version of SDL (and for that matter, XFree, or whatever X server you’re

I’m running XFree 4.3.0.1 on Debain testing, SDL 1.2.3 and sge version
020904, all on a kernel 2.6.8.

running) are you using? You might try exiting by intentional segfault
(or prehaps simply sending a signal) to trip the SDL parachute, and see
if the problem goes away when you do so. Are you sure you’re calling
SDL_Quit in all the right places?

Yes, SDL_Quit() is the last line of main(), and that is the only way to end
the program (no exit()) except for a segfault. I’ll try a segfault later -
what would be the consequence if this works?

Matthias

My game has identical problems (lots of enters in the console once you
exit, the enter key doen’t work sometimes), and someone else once posted
here that theirs did too. It appears to be a conflict between the dga
video driver and something else (this only happens if you use the dga
driver). The other poster suggested maybe it is dga conflicting with a
sound library somehow, and said it only seemed to happen if sound was
enabled. I could never actually be bothered to test whether or not this
is
the case.

The most likely reason that this bug isn’t more widely known is that
hardly anyone uses dga.

James

I’m running XFree 4.3.0.1 on Debain testing, SDL 1.2.3 and sge version
020904, all on a kernel 2.6.8.

1.2.7 Is out, you can download it here:
http://www.libsdl.org/download-1.2.php

Or, since you’re on debian, you could use their packages - 1.2.4 is in
stable, testing and unstable are both 1.2.7 (at least in the package
libsdl1.2debian-all)

I’m using a mostly-stable debian system, to upgrade, I did (as root):

apt-get update

apt-get -t testing install libsdl1.2debian-all

If you’re fully running testing, it should just be a matter of:

apt-get update

apt-get install libsdl1.2debian-all

Or if you want to update all your out of date packages systemwide:

apt-get update

apt-get upgrade

(I just ran that command, maybe 10 of my packages were from
stable/unstable, the other 40 all being libraries from testing 0_o).

Yes, SDL_Quit() is the last line of main(), and that is the only way to end
the program (no exit()) except for a segfault. I’ll try a segfault later -
what would be the consequence if this works?

In that case I would say it is most likely a bug in SDL, or a bug in X
that can be worked around in SDL. I havn’t peeked at the SDL source
recently, so the parachute code might just do little more than
SDL_Quit() and say “Parachute!!!1111oneoneone”, meaning it wouldn’t fix
your problem.

If you can try to stub out code until it stops breaking, that would help
track down the problem.

The other thing to try (in response to James Gregory’s comment that it
might be a sound library conflict with DGA) would be to try changing
your init flags so that the sounds subsystem is never activated
(assuming it is).

Hi all!

I have a weird problem with the keyboard (linux, SDL+sge library).
Sometimes, but not always, the return key is no longer responding when I
start my program for the second time (I can always run it once without a
problem). Usually in this case I get lots of “returns” in the shell from
which I started the program after leaving it. Then it is not sufficient to
kill the X server, I have to reboot the machine to get rid of this problem!

It sounds like the SDL window isn’t getting focus for some reason.
Are you running any other programs that might grab or reset keyboard focus?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment