Fix Atlas under macOS Sierra.
We were polling SDL messages from two different threads (by mistake), and Sierra now refuses to do that. Tested by Stan, Itms, Fatherbushido, and discussed with Philip for the code change itself. Fixes #4408. Differential Revision: https://code.wildfiregames.com/D42 This was SVN commit r19160.
This commit is contained in:
parent
8813888fe0
commit
8fec942e8a
@ -77,14 +77,17 @@ void in_push_priority_event(const SDL_Event_* event)
|
||||
priority_events.push_back(*event);
|
||||
}
|
||||
|
||||
int in_poll_priority_event(SDL_Event_* event)
|
||||
{
|
||||
if (priority_events.empty())
|
||||
return 0;
|
||||
|
||||
*event = priority_events.front();
|
||||
priority_events.pop_front();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int in_poll_event(SDL_Event_* event)
|
||||
{
|
||||
if (!priority_events.empty())
|
||||
{
|
||||
*event = priority_events.front();
|
||||
priority_events.pop_front();
|
||||
return 1;
|
||||
}
|
||||
|
||||
return SDL_PollEvent(&event->ev);
|
||||
return in_poll_priority_event(event) ? 1 : SDL_PollEvent(&event->ev);
|
||||
}
|
||||
|
@ -59,7 +59,11 @@ extern void in_dispatch_event(const SDL_Event_* event);
|
||||
// be returned by in_poll_event before any standard SDL events
|
||||
extern void in_push_priority_event(const SDL_Event_* event);
|
||||
|
||||
// reads events that were pushed by in_push_priority_event, or (if there are
|
||||
// reads events that were pushed by in_push_priority_event
|
||||
// returns 1 if an event was read, 0 otherwise.
|
||||
extern int in_poll_priority_event(SDL_Event_* event);
|
||||
|
||||
// reads events that were pushed by in_push_priority_event, or, if there are
|
||||
// no high-priority events) reads from the SDL event queue with SDL_PollEvent.
|
||||
// returns 1 if an event was read, 0 otherwise.
|
||||
extern int in_poll_event(SDL_Event_* event);
|
||||
|
@ -218,7 +218,7 @@ static void* RunEngine(void* data)
|
||||
|
||||
// Pump SDL events (e.g. hotkeys)
|
||||
SDL_Event_ ev;
|
||||
while (in_poll_event(&ev))
|
||||
while (in_poll_priority_event(&ev))
|
||||
in_dispatch_event(&ev);
|
||||
|
||||
if (g_GUI)
|
||||
|
Loading…
Reference in New Issue
Block a user