SDL 1.3 events

I am not getting keyboard and mouse events under SDL 1.3. I seem to recall
a post a while back about some differences with SDL 1.3 and how it handles
events.

I have a routine (shown below) that checks events once per frame in my game
loop. I do get SDL_WINDOWEVENT’s, but no keyboard or mouse events.

Is there something I need to add to get these events? The minimum sample
Apps for SDL 1.3 don’t have anything else, but they are also not handling
mouse and keyboard events.

Ken

void ProcessEvents( void )

{

            SDL_Event               event;



            SDL_PumpEvents();



            if ( SDL_PeepEvents( &event,1,SDL_GETEVENT,SDL_ALLEVENTS ) )

            {

                            switch( event.type )

                            {

#if ( SDL_MINOR_VERSION == 3 )

                                            case SDL_WINDOWEVENT:

                                                            switch(

event.window.event )

                                                            {

                                                            case

SDL_WINDOWEVENT_CLOSE:

if ( g_pGame )

{

g_pGame->QuitGame();

}

break;

                                                            }

                                                            break;

#endif

                                            case SDL_ACTIVEEVENT:

                                                            if (

event.active.state & (SDL_APPINPUTFOCUS|SDL_APPACTIVE) )

                                                            {

if ( event.active.gain == 0 )

{

// We lost focus

if ( g_pGame )

g_pGame->Pause();

}

else

{

// We got focus

if ( g_pGame )

g_pGame->Resume();

}

                                                            }

                                                            break;



                                            case SDL_MOUSEBUTTONDOWN:

                                                            {

// Snipped code to save off mouse down info

// If I set a breakpoint here I never hit it

                                                            }

                                                            break;



                                            case SDL_MOUSEBUTTONUP:

                                                            {

// Snipped code to save off mouse up info

// If I set a breakpoint here I never hit it

                                                            }

                                                            break;



                                            case SDL_MOUSEMOTION:

                                                            {

// Snipped code to save off mouse motion info

// If I set a breakpoint here I never hit it

                                                            }

                                                            break;



                                            case SDL_KEYDOWN:

                                            case SDL_KEYUP:

                                                            {

// Snipped code to save off key down/up info

// If I set a breakpoint here I never hit it

                                                            }

                                                            break;



                                            case SDL_QUIT:

                                                            if ( g_pGame

)

                                                            {

g_pGame->QuitGame();

                                                            }

                                                            break;



                                            default:

                                                            break;

                            }

            }

}

I entered a small app that shows this bug into the bug database. I can work
around it by not calling the SDL_VideoInit() function, but still get a
similar issue if I run the app while using LogMeIn. Before anyone says
"that is a LogMeIn issue", please note that it works fine using LogMeIn if I
use SDL-1.3 with the old API. I suspect that it is related to DirectInput
exclusive flags, or to the app not capturing the input.

Icculus (Sorry, I don’t know your real name), when you look at bug 916 can
you check the capture for mouse events?From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Ken Rogoway
Sent: Wednesday, December 23, 2009 5:10 PM
To: 'SDL Development List’
Subject: [SDL] SDL 1.3 events

I am not getting keyboard and mouse events under SDL 1.3. I seem to recall
a post a while back about some differences with SDL 1.3 and how it handles
events.

I have a routine (shown below) that checks events once per frame in my game
loop. I do get SDL_WINDOWEVENT’s, but no keyboard or mouse events.

Is there something I need to add to get these events? The minimum sample
Apps for SDL 1.3 don’t have anything else, but they are also not handling
mouse and keyboard events.

Ken

void ProcessEvents( void )

{

            SDL_Event               event;



            SDL_PumpEvents();



            if ( SDL_PeepEvents( &event,1,SDL_GETEVENT,SDL_ALLEVENTS ) )

            {

                            switch( event.type )

                            {

#if ( SDL_MINOR_VERSION == 3 )

                                            case SDL_WINDOWEVENT:

                                                            switch(

event.window.event )

                                                            {

                                                            case

SDL_WINDOWEVENT_CLOSE:

if ( g_pGame )

{

g_pGame->QuitGame();

}

break;

                                                            }

                                                            break;

#endif

                                            case SDL_ACTIVEEVENT:

                                                            if (

event.active.state & (SDL_APPINPUTFOCUS|SDL_APPACTIVE) )

                                                            {

if ( event.active.gain == 0 )

{

// We lost focus

if ( g_pGame )

g_pGame->Pause();

}

else

{

// We got focus

if ( g_pGame )

g_pGame->Resume();

}

                                                            }

                                                            break;



                                            case SDL_MOUSEBUTTONDOWN:

                                                            {

// Snipped code to save off mouse down info

// If I set a breakpoint here I never hit it

                                                            }

                                                            break;



                                            case SDL_MOUSEBUTTONUP:

                                                            {

// Snipped code to save off mouse up info

// If I set a breakpoint here I never hit it

                                                            }

                                                            break;



                                            case SDL_MOUSEMOTION:

                                                            {

// Snipped code to save off mouse motion info

// If I set a breakpoint here I never hit it

                                                            }

                                                            break;



                                            case SDL_KEYDOWN:

                                            case SDL_KEYUP:

                                                            {

// Snipped code to save off key down/up info

// If I set a breakpoint here I never hit it

                                                            }

                                                            break;



                                            case SDL_QUIT:

                                                            if ( g_pGame

)

                                                            {

g_pGame->QuitGame();

                                                            }

                                                            break;



                                            default:

                                                            break;

                            }

            }

}

I just noticed this in my in box, what can I say, the holidays are
good days not to ignore email :-).

Has it been resolved? If not, try #define SDL_NO_COMPAT in front of
#include any SDL.h file. That will force your code to compile without
the SDL 1.3 compatibility layer. If doing that breaks your compile
then fix it to no use any part of the compatibility layer. If nothing
else, it will let you know if the problem is in SDL 1.3 or in the
compatibility layer and get the information needed to fix the problem.

66% of the times I’ve seen true weirdness in an SDL 1.3 program it has
been due to the compatibility layer. The rest… well 1.3 is still
young.

Bob PendletonOn Wed, Dec 23, 2009 at 5:10 PM, Ken Rogoway wrote:

I am not getting keyboard and mouse events under SDL 1.3.? I seem to recall
a post a while back about some differences with SDL 1.3 and how it handles
events.

I have a routine (shown below) that checks events once per frame in my game
loop.? I do get SDL_WINDOWEVENT?s, but no keyboard or mouse events.

Is there something I need to add to get these events?? The minimum sample
Apps for SDL 1.3 don?t have anything else, but they are also not handling
mouse and keyboard events.

Ken

void ProcessEvents( void )

{

??? SDL_Event??? event;

??? SDL_PumpEvents();

??? if ( SDL_PeepEvents( &event,1,SDL_GETEVENT,SDL_ALLEVENTS ) )

??? {

??? switch( event.type )

??? {

#if ( SDL_MINOR_VERSION == 3 )

??? case SDL_WINDOWEVENT:

??? switch(
event.window.event )

??? {

??? case
SDL_WINDOWEVENT_CLOSE:

if ( g_pGame )

{

g_pGame->QuitGame();

}

break;

??? }

??? break;

#endif

??? case SDL_ACTIVEEVENT:

??? if (
event.active.state & (SDL_APPINPUTFOCUS|SDL_APPACTIVE) )

??? {

if ( event.active.gain == 0 )

{

// We lost focus

if ( g_pGame )

g_pGame->Pause();

}

else

{

// We got focus

if ( g_pGame )

g_pGame->Resume();

}

??? }

??? break;

??? case SDL_MOUSEBUTTONDOWN:

??? {

// Snipped code to save off mouse down info

// If I set a breakpoint here I never hit it

??? }

??? break;

??? case SDL_MOUSEBUTTONUP:

??? {

// Snipped code to save off mouse up info

// If I set a breakpoint here I never hit it

??? }

??? ??? break;

??? case SDL_MOUSEMOTION:

??? {

// Snipped code to save off mouse motion info

// If I set a breakpoint here I never hit it

??? }

??? break;

??? case SDL_KEYDOWN:

??? case SDL_KEYUP:

??? {

// Snipped code to save off key down/up info

??? // If I set
a breakpoint here I never hit it

??? }

??? break;

??? case SDL_QUIT:

??? if ( g_pGame
)

??? {

g_pGame->QuitGame();

??? }

??? break;

??? default:

??? break;

??? }

??? }

}


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------

Hey, I was just about to look at this and I found my Windows 7 install
has expired.

I’ll try to get a copy this weekend and look again.

See ya!On Fri, Jan 1, 2010 at 8:25 PM, Ken Rogoway wrote:

I entered a small app that shows this bug into the bug database.? I can work
around it by not calling the SDL_VideoInit() function, but still get a
similar issue if I run the app while using LogMeIn.? Before anyone says
?that is a LogMeIn issue?, please note that it works fine using LogMeIn if I
use SDL-1.3 with the old API.? I suspect that it is related to DirectInput
exclusive flags, or to the app not capturing the input.

Icculus (Sorry, I don?t know your real name), when you look at bug 916 can
you check the capture for mouse events?

From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Ken Rogoway
Sent: Wednesday, December 23, 2009 5:10 PM
To: 'SDL Development List’
Subject: [SDL] SDL 1.3 events

I am not getting keyboard and mouse events under SDL 1.3.? I seem to recall
a post a while back about some differences with SDL 1.3 and how it handles
events.

I have a routine (shown below) that checks events once per frame in my game
loop.? I do get SDL_WINDOWEVENT?s, but no keyboard or mouse events.

Is there something I need to add to get these events?? The minimum sample
Apps for SDL 1.3 don?t have anything else, but they are also not handling
mouse and keyboard events.

Ken

void ProcessEvents( void )

{

??? SDL_Event??? event;

??? SDL_PumpEvents();

??? if ( SDL_PeepEvents( &event,1,SDL_GETEVENT,SDL_ALLEVENTS ) )

??? {

??? switch( event.type )

??? {

#if ( SDL_MINOR_VERSION == 3 )

??? case SDL_WINDOWEVENT:

??? switch(
event.window.event )

??? {

??? case
SDL_WINDOWEVENT_CLOSE:

if ( g_pGame )

{

g_pGame->QuitGame();

}

break;

??? }

??? break;

#endif

??? case SDL_ACTIVEEVENT:

??? if (
event.active.state & (SDL_APPINPUTFOCUS|SDL_APPACTIVE) )

??? {

if ( event.active.gain == 0 )

{

// We lost focus

if ( g_pGame )

g_pGame->Pause();

}

else

{

// We got focus

if ( g_pGame )

g_pGame->Resume();

}

??? }

??? break;

??? case SDL_MOUSEBUTTONDOWN:

??? {

// Snipped code to save off mouse down info

// If I set a breakpoint here I never hit it

??? }

??? break;

??? case SDL_MOUSEBUTTONUP:

??? {

// Snipped code to save off mouse up info

// If I set a breakpoint here I never hit it

??? }

??? ??? break;

??? case SDL_MOUSEMOTION:

??? {

// Snipped code to save off mouse motion info

// If I set a breakpoint here I never hit it

??? }

??? break;

??? case SDL_KEYDOWN:

??? case SDL_KEYUP:

??? {

// Snipped code to save off key down/up info

??? // If I set
a breakpoint here I never hit it

??? }

??? break;

??? case SDL_QUIT:

??? if ( g_pGame
)

??? {

g_pGame->QuitGame();

??? }

??? break;

??? default:

??? break;

??? }

??? }

}


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC