I have registered an event to tell me when I receive something from Dropbox.
Uint32 SDL_DROPBOX_FILELIST = 0;
SDL_DROPBOX_FILELIST = SDL_RegisterEvents( 1 );
SDL_DROPBOX_FILELIST
is assigned a value of 32768, or 32769 if I create a second event.
Java code calls a JNI C function when the Dropbox operation is complete so I want to post an SDL user event into my main thread containing the typical SDL event processing loop.
SDL_Event evt;
SDL_memset( &evt, 0, sizeof( evt ));
evt.type = SDL_DROPBOX_FILELIST;
evt.user.code = i;
evt.user.data1 = pszCopy;
evt.user.data2 = 0;
int rc = SDL_PushEvent( &evt );
rc
returns 1 so it would appear that the SDL_PushEvent()
is successful.
My problem is that I never receive the SDL_DROPBOX_FILELIST event in my main thread SDL event handling loop. Is there anything else I need to do or should be aware of?
If I get some more time I can knock up a smaller demo test app etc but just asking the question(s) in the meantime…
My main loop is something like this (edited):
while( g_Running )
{
while( SDL_PollEvent( &event ) )
{
switch( event.type )
{
case SDL_WINDOWEVENT:
break;
// Mouse events handlers here etc
case SDL_QUIT:
g_Running = false;
break;
default:
if( event.type == SDL_DROPBOX_FILELIST )
LogDebugf( "SDL_DROPBOX_FILELIST" );
break;
}
}
}
Is there an issue with calling SDL_PushEvent() from a thread other than the main loop thread?