SDLK_RETURN events

Has anybody had any trouble with mistaken SDLK_RETURN events? I have a
simple event loop using SDL_PollEvent() and using a switch statement to
check the event, and every so often it seems to mistakenly report an
SDLK_RETURN option when there is none. Any other key I’ve tried, like
SDLK_SPACE instead, doesn’t seem to do this … so, I was wondering if
anybody else has had similiar behavior?

– chris (@Christopher_Thielen)

Chris Thielen [020808 11:49]:

Has anybody had any trouble with mistaken SDLK_RETURN events? I have a
simple event loop using SDL_PollEvent() and using a switch statement to
check the event, and every so often it seems to mistakenly report an
SDLK_RETURN option when there is none. Any other key I’ve tried, like
SDLK_SPACE instead, doesn’t seem to do this … so, I was wondering if
anybody else has had similiar behavior?

Yes, but I can’t reproduce it. Sometimes it happens, sometimes not. I think
it might be connected to the fact, that at the start of the program the
keystates are undefined. So I’m looking for a way to explicitly set all keys
to RELEASED and than start main loop. I think this would fix the problem,
but I don’t know how to do it.

So any help is very welcome!!!

Steinchen–
http://www.hpfsc.de/ - die Seite rund um:
Assembler, Bundeswehr, TFT LCDs, Halle/Saale, Fahrradtouren,
Wanderstaat Mauma, Raumschiff USS Nathan, Enemy Room, MLCAD Tutorial

Chris Thielen [020808 11:49]:

Has anybody had any trouble with mistaken SDLK_RETURN events? I have a
simple event loop using SDL_PollEvent() and using a switch statement to
check the event, and every so often it seems to mistakenly report an
SDLK_RETURN option when there is none. Any other key I’ve tried, like
SDLK_SPACE instead, doesn’t seem to do this … so, I was wondering if
anybody else has had similiar behavior?

Does it happen immediately after the program starts?
What operating system and video subsystem are you using?

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

It only occurs every once in a while, and yes, it happens immediately
after the program starts. I have experienced this issue (as well as
received reports of this issue) while using Linux, and have only tried
under X11. What do you think it could be?

– chris (@Christopher_Thielen)On Fri, 2002-08-09 at 17:58, Sam Lantinga wrote:

Chris Thielen <@Christopher_Thielen> [020808 11:49]:

Has anybody had any trouble with mistaken SDLK_RETURN events? I have a
simple event loop using SDL_PollEvent() and using a switch statement to
check the event, and every so often it seems to mistakenly report an
SDLK_RETURN option when there is none. Any other key I’ve tried, like
SDLK_SPACE instead, doesn’t seem to do this … so, I was wondering if
anybody else has had similiar behavior?

Does it happen immediately after the program starts?
What operating system and video subsystem are you using?

Does it happen immediately after the program starts?
What operating system and video subsystem are you using?

It only occurs every once in a while, and yes, it happens immediately
after the program starts. I have experienced this issue (as well as
received reports of this issue) while using Linux, and have only tried
under X11. What do you think it could be?

I just had this problem start just now. I’m also in Linux.

To me it seems to be the pushing of enter to start the program works its way
into the program itself. Perhaps holding it down a split second too long? I
just now started getting the problem because I just assigned an action to the
enter key.

MattOn Saturday 10 August 2002 12:24 am, Chris Thielen wrote:

I just had this problem start just now. I’m also in Linux.

To me it seems to be the pushing of enter to start the program works its
way into the program itself. Perhaps holding it down a split second too
long? I just now started getting the problem because I just assigned an
action to the enter key.

Sorry, quick follow up to myself. I do believe that is the case because if I
start my program with the enter that’s over on the number pad, I don’t have
any problems at all. Starting it with the standard enter key and I get the
SDLK_RETURN event probably 40% of the time.

Seems a quick fix is to just “soak up” any SDLK_RETURN events there may be
right at the start of the program.

MattOn Saturday 10 August 2002 02:24 am, Matt Greer wrote:

Yea. I don’t know too many about X11 programming and the x events, but
if I did I’d check see if this is indeed a bug in SDL, and if so, how to
go about fixing it. I’d like to hear what Sam says about it, but I’m
pretty sure it’s an SDL bug.

– chris (@Christopher_Thielen)On Sat, 2002-08-10 at 00:28, Matt Greer wrote:

Sorry, quick follow up to myself. I do believe that is the case because if I
start my program with the enter that’s over on the number pad, I don’t have
any problems at all. Starting it with the standard enter key and I get the
SDLK_RETURN event probably 40% of the time.

Seems a quick fix is to just “soak up” any SDLK_RETURN events there may be
right at the start of the program.

Matt Greer [020810 10:42]:

Seems a quick fix is to just “soak up” any SDLK_RETURN events there may be
right at the start of the program.

And how can you do this? Can you please provide a smal code sample?

Thanks,

Steinchen–
http://www.hpfsc.de/ - die Seite rund um:
Assembler, Bundeswehr, TFT LCDs, Halle/Saale, Fahrradtouren,
Wanderstaat Mauma, Raumschiff USS Nathan, Enemy Room, MLCAD Tutorial

int main(void)
{
SDL_Event *event;

// Do SDL initialization

while (SDL_PollEvent(&event)
{
// Soak up any pending events
}

// Start your application code here…
}On Saturday 10 August 2002 02:45 am, you wrote:

Matt Greer [020810 10:42]:

Seems a quick fix is to just “soak up” any SDLK_RETURN events there may
be right at the start of the program.

And how can you do this? Can you please provide a smal code sample?

Thanks,

Steinchen

j_post <j_post at pacbell.net> [020811 22:58]:

int main(void)
{
SDL_Event *event;

// Do SDL initialization

while (SDL_PollEvent(&event)
{
// Soak up any pending events
}

// Start your application code here…
}

Mmmh, yes! Very easy!!!

Thanks,

Steinchen–
http://www.hpfsc.de/ - die Seite rund um:
Assembler, Bundeswehr, TFT LCDs, Halle/Saale, Fahrradtouren,
Wanderstaat Mauma, Raumschiff USS Nathan, Enemy Room, MLCAD Tutorial

So, is this a bug in SDL though? Instead of a workaround, shouldn’t it
be fixed?

– chris (@Christopher_Thielen)On Sun, 2002-08-11 at 14:47, Sebastian Stein wrote:

j_post <j_post at pacbell.net> [020811 22:58]:

int main(void)
{
SDL_Event *event;

// Do SDL initialization

while (SDL_PollEvent(&event)
{
// Soak up any pending events
}

// Start your application code here…
}

Mmmh, yes! Very easy!!!

So, is this a bug in SDL though? Instead of a workaround, shouldn’t it
be fixed?

Yes, I’ll look into it.

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

Sam Lantinga writes:

Chris Thielen [020808 11:49]:

Has anybody had any trouble with mistaken SDLK_RETURN events? I have a
simple event loop using SDL_PollEvent() and using a switch statement to
check the event, and every so often it seems to mistakenly report an
SDLK_RETURN option when there is none. Any other key I’ve tried, like
SDLK_SPACE instead, doesn’t seem to do this … so, I was wondering if
anybody else has had similiar behavior?

Does it happen immediately after the program starts?
What operating system and video subsystem are you using?

Ok, I have reports of an issue that sound exactly like this happening
in the Hyperspace Delivery Boy - sometimes the return key seems to be
stuck at “pressed” when the game starts. I have yet to reproduce this
myself.

Could this be the same issue (I have a hard time believing it’s a
problem in the game). I get the key states by calling
SDL_GetKeyState() rather than looking at events however.–
[ Below is a random fortune, which is unrelated to the above message. ]
Counting in octal is just like counting in decimal–if you don’t use your thumbs.
– Tom Lehrer

Ok, I have reports of an issue that sound exactly like this happening
in the Hyperspace Delivery Boy - sometimes the return key seems to be
stuck at “pressed” when the game starts. I have yet to reproduce this
myself.

Could this be the same issue (I have a hard time believing it’s a
problem in the game). I get the key states by calling
SDL_GetKeyState() rather than looking at events however.

Yes, it should be fixed in the latest CVS.
I’ll release SDL 1.2.5 as soon as I get some time.

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

Sam Lantinga writes:

Ok, I have reports of an issue that sound exactly like this happening
in the Hyperspace Delivery Boy - sometimes the return key seems to be
stuck at “pressed” when the game starts. I have yet to reproduce this
myself.

Could this be the same issue (I have a hard time believing it’s a
problem in the game). I get the key states by calling
SDL_GetKeyState() rather than looking at events however.

Yes, it should be fixed in the latest CVS.
I’ll release SDL 1.2.5 as soon as I get some time.

I believe that it indeed is fixed (at least my testers haven’t been
able to reproduce the issue so far).–
[ Below is a random fortune, which is unrelated to the above message. ]
Q: How do you keep a moron in suspense?