[client,sdl] use SDL_WaitEvent

This commit is contained in:
Armin Novak 2023-05-30 18:22:57 +02:00 committed by Martin Fleisz
parent 3e44efc841
commit 324e8c7813
3 changed files with 10 additions and 3 deletions

View File

@ -700,7 +700,7 @@ static int sdl_run(sdlContext* sdl)
{
SDL_Event windowEvent = { 0 };
while (!freerdp_shall_disconnect_context(&sdl->common.context) &&
SDL_PollEvent(&windowEvent))
SDL_WaitEvent(&windowEvent))
{
#if defined(WITH_DEBUG_SDL_EVENTS)
SDL_Log("got event %s [0x%08" PRIx32 "]", sdl_event_type_str(windowEvent.type),
@ -854,6 +854,7 @@ static int sdl_run(sdlContext* sdl)
case SDL_USEREVENT_POINTER_SET:
sdl_Pointer_Set_Process(&windowEvent.user);
break;
case SDL_USEREVENT_QUIT:
default:
break;
}
@ -1103,6 +1104,10 @@ terminate:
sdl_map_to_code_tag(exit_code), exit_code);
sdl->exit_code = exit_code;
sdl_push_user_event(SDL_USEREVENT_QUIT);
#if SDL_VERSION_ATLEAST(2, 0, 16)
SDL_TLSCleanup();
#endif
return 0;
}

View File

@ -103,7 +103,7 @@ const char* sdl_event_type_str(Uint32 type)
EV_CASE_STR(SDL_USEREVENT_POINTER_DEFAULT);
EV_CASE_STR(SDL_USEREVENT_POINTER_POSITION);
EV_CASE_STR(SDL_USEREVENT_POINTER_SET);
EV_CASE_STR(SDL_USEREVENT_QUIT);
EV_CASE_STR(SDL_LASTEVENT);
default:
return "SDL_UNKNOWNEVENT";
@ -163,6 +163,7 @@ BOOL sdl_push_user_event(Uint32 type, ...)
event->data1 = va_arg(ap, void*);
event->code = va_arg(ap, int);
break;
case SDL_USEREVENT_QUIT:
case SDL_USEREVENT_POINTER_NULL:
case SDL_USEREVENT_POINTER_DEFAULT:
break;

View File

@ -50,7 +50,8 @@ enum
SDL_USEREVENT_POINTER_NULL,
SDL_USEREVENT_POINTER_DEFAULT,
SDL_USEREVENT_POINTER_POSITION,
SDL_USEREVENT_POINTER_SET
SDL_USEREVENT_POINTER_SET,
SDL_USEREVENT_QUIT
};
BOOL sdl_push_user_event(Uint32 type, ...);