Keyboard event's not recieved

Hi! I wrote a input config dialog with gtk… it works well when reading
joystick axis/buttons… i am using SDL_InitSubSystem() with SDL_INIT_VIDEO,
SDL_INIT_JOYSTICK and SDL_INIT_EVENTTHREAD, but the function reading a
button/key doesn’t recieve key events… here’s the code:


SDL_InitSubSystem()

SDL_Event event;
SDL_Joystick *joy;

joy = SDL_JoystickOpen( cont->device );
if ( !joy )
return;

if ( !SDL_WaitEvent( &event ) )
return; /* No assignment */

switch ( event.type )
{
case SDL_JOYBUTTONDOWN:

break;

case SDL_JOYAXISMOTION:

break;

case SDL_KEYDOWN:
fprintf( stderr, “!!! SDL_KEYDOWN !!!\n” );
}

hmm… code can’t be wrong… so i wonder if i need to set a video mode
to be able to get keys or am i missing something else?

thanks!

hmm… code can’t be wrong… so i wonder if i need to set a video mode
to be able to get keys

Yep. There’s no other way for SDL to get your keyboard input. :slight_smile:

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

hmm… code can’t be wrong… so i wonder if i need to set a video mode
to be able to get keys

Yep. There’s no other way for SDL to get your keyboard input. :slight_smile:

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

i really would prefer not to say this, but that sux (i am sure there’s a
reason for this…)
i have an app which loads a plugin for video and has internal input
handling… is there no way to get events without initializing video from
that thread?

thanks,
gregorOn Sat, 04 May 2002 17:10:18 +0200, Sam Lantinga wrote:

Grab the lastest SDL sources and look in the test folder,
there is a file call checkkeys.c, complie ,run and study it.

Always check this folder before panicking !

Jocelyn.

“Gregor Anich” a ?crit dans le message news:
ab0kr4$2ueg$1 at hoth.stenstad.net

Hi! I wrote a input config dialog with gtk… it works well when reading
joystick axis/buttons… i am using SDL_InitSubSystem() with
SDL_INIT_VIDEO,> SDL_INIT_JOYSTICK and SDL_INIT_EVENTTHREAD, but the function reading a
button/key doesn’t recieve key events… here’s the code:


SDL_InitSubSystem()

SDL_Event event;
SDL_Joystick *joy;

joy = SDL_JoystickOpen( cont->device );
if ( !joy )
return;

if ( !SDL_WaitEvent( &event ) )
return; /* No assignment */

switch ( event.type )
{
case SDL_JOYBUTTONDOWN:

break;

case SDL_JOYAXISMOTION:

break;

case SDL_KEYDOWN:
fprintf( stderr, “!!! SDL_KEYDOWN !!!\n” );
}

hmm… code can’t be wrong… so i wonder if i need to set a video mode
to be able to get keys or am i missing something else?

thanks!

i really would prefer not to say this, but that sux (i am sure there’s a
reason for this…)

SDL gets keydown/keyup events sent to a window. Many targets will require
this to receive events at all. This isn’t a design limitation of SDL, it’s
a portability issue.

–ryan.

i really would prefer not to say this, but that sux (i am sure there’s
a reason for this…)

SDL gets keydown/keyup events sent to a window. Many targets will
require this to receive events at all. This isn’t a design limitation of
SDL, it’s a portability issue.

–ryan.

oh… will it work if the video plugin inits video, then from another
thread input is initialized? or init video + input, uninit video, init
video from video thread?

:slight_smile:

thanks!On Sat, 04 May 2002 22:39:38 +0200, Ryan C. Gordon wrote: