Infinite keyboard events after SDL_SetVideoMode

Hi, everybody!

I try to do a fullscreen toggling without SDL_WM_ToggleFullScreen(). It
is a reaction on a KEYDOWN event (e.g. F12). I use SDL_SetVideoMode with
SDL_FULLSCREEN set or unset depending on the setting before. I think
this should work.

But:
If the key is pressed, the video mode is set as it should, but obviously
(I’ve tested it) there come in lots and lots of KEYDOWN events after
that, all with the same “toggling” key. So the program switches steadily
between windowed and fullscreen mode. It doesn’t stop. Why?
The problem exists in Linux and Win95.

I think it has to do with the different event queues created each time
SDL_SetVideoMode is called. Is it possible that the last event of the
old queue resides in the new one without being erased?

HELP!

Rainer Loritz

Ben had the same problem here and we’ve got it on our list of things
to follow up. You can work around it for now by changing video mode
on the key up event.

FrancisOn Wed, 05 Jul 2000 15:38:28 +0200, you wrote:

But:
If the key is pressed, the video mode is set as it should, but obviously
(I’ve tested it) there come in lots and lots of KEYDOWN events after
that, all with the same “toggling” key. So the program switches steadily
between windowed and fullscreen mode. It doesn’t stop. Why?
The problem exists in Linux and Win95.

Hey, thank you very much!

That’s unbelievable. I would never have come to that idea. It is not
that elegant I like it normally, but it works.

Maybe I should dive into the SDL sources to find the reason, but I think
I have not enough time at the moment…

Thanks again

Rainer

Hi!On Wed, 5 Jul 2000, Rainer Loritz wrote:

Maybe I should dive into the SDL sources to find the reason

It probably has to do with the key repeat. My solution was to
disable the key repeat before switching the video mode, and
re-enabling it afterwards.

Bye,
Christian


/ Coding on PowerPC and proud of it
/ http://www.uni-mainz.de/~bauec002/

Rainer Loritz wrote:

Hey, thank you very much!

That’s unbelievable. I would never have come to that idea. It is not
that elegant I like it normally, but it works.

Maybe I should dive into the SDL sources to find the reason, but I think
I have not enough time at the moment…

It could very well be an X/DGA bug. It looks like X itself is getting
confused about keystates, if it thinks the key is still pressed.

Ben.–
Ben Campbell (Antipodean Straggler)
Programmer, CyberLife Technology Ltd
ben.campbell at cyberlife.co.uk
www.creatures.co.uk

Hi!

Maybe I should dive into the SDL sources to find the reason

It probably has to do with the key repeat. My solution was to
disable the key repeat before switching the video mode, and
re-enabling it afterwards.

I’ll take a look at this when I get a chance. Can somebody send me
a quick example that demonstrates this problem?

Thanks!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software> On Wed, 5 Jul 2000, Rainer Loritz wrote: