Hi,
I’ve encountered a problem with SDL on Win32 (Windows 2000 SP2 and
using the 1.2.5 SDL.DLL from libsdl.org). When running an SDL app and
using alt-tab to switch to another task, then switching back by
pressing alt-tab again, SDL sometimes doesn’t notice that the alt-key
has been released.
I’ve written a simple test program. It displays the keys that are
pressed. A sample session is as follows:
- run program
- press ‘d’ for example , the programm prints ‘d’
- press ‘alt-d’ for example , the programm prints ‘d alt’
- now press alt-tab and switch to another program. the test program
displays the tab character and ‘alt’.
- release all keys
- now press alt-tab again to switch to the test program
- release all keys
- press a key, for example ‘d’ again. The test program prints 'd alt ’
This does not happen always, it happens at about 10% of all task
switches. I couldn’t find any reason why this is sometimes happening
and sometimes not.
Any ideas how this can be fixed ?
Here’s the test program:
#include
#include <sdl.h>
int main( )
{
SDL_Init(SDL_INIT_VIDEO);
SDL_SetVideoMode(800, 600, 8,0 );
while ( 1 ) {
SDL_Event event;
if ( SDL_PollEvent ( &event ) == 1) {
switch ( event.type ) {
case SDL_KEYDOWN:
{
printf("%c", event.key.keysym.sym );
if ( event.key.keysym.mod & KMOD_ALT )
printf(" alt");
printf("\n");
}
break;
case SDL_QUIT: exit(0);
}
}
}
}
Could this be a Windows bug? I know 95/98 have a lot of annoying keyboard
bugs…
Martin Bickel wrote:> Hi,
I’ve encountered a problem with SDL on Win32 (Windows 2000 SP2 and
using the 1.2.5 SDL.DLL from libsdl.org). When running an SDL app and
using alt-tab to switch to another task, then switching back by
pressing alt-tab again, SDL sometimes doesn’t notice that the alt-key
has been released.
I’ve written a simple test program. It displays the keys that are
pressed. A sample session is as follows:
- run program
- press ‘d’ for example , the programm prints ‘d’
- press ‘alt-d’ for example , the programm prints ‘d alt’
- now press alt-tab and switch to another program. the test program
displays the tab character and ‘alt’.
- release all keys
- now press alt-tab again to switch to the test program
- release all keys
- press a key, for example ‘d’ again. The test program prints 'd alt ’
This does not happen always, it happens at about 10% of all task
switches. I couldn’t find any reason why this is sometimes happening
and sometimes not.
Any ideas how this can be fixed ?
Here’s the test program:
#include
#include <sdl.h>
int main( )
{
SDL_Init(SDL_INIT_VIDEO);
SDL_SetVideoMode(800, 600, 8,0 );
while ( 1 ) {
SDL_Event event;
if ( SDL_PollEvent ( &event ) == 1) {
switch ( event.type ) {
case SDL_KEYDOWN:
{
printf("%c", event.key.keysym.sym );
if ( event.key.keysym.mod & KMOD_ALT )
printf(" alt");
printf("\n");
}
break;
case SDL_QUIT: exit(0);
}
}
}
}
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
yeah, it seems to me that this could be a windows bug, too, because i’ve
noticed similar things happening in pretty much every windows app
M@ the MadProgrammer_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail