mirror of https://github.com/mgba-emu/mgba.git
Move event polling to after framedraw only
This commit is contained in:
parent
ac0c7ba792
commit
374aca2ff7
25
src/main.c
25
src/main.c
|
@ -127,6 +127,19 @@ static void _GBASDLRunloop(struct GBAThread* context, struct GLSoftwareRenderer*
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
|
|
||||||
|
while (SDL_PollEvent(&event)) {
|
||||||
|
switch (event.type) {
|
||||||
|
case SDL_QUIT:
|
||||||
|
// FIXME: this isn't thread-safe
|
||||||
|
context->debugger->state = DEBUGGER_EXITING;
|
||||||
|
break;
|
||||||
|
case SDL_KEYDOWN:
|
||||||
|
case SDL_KEYUP:
|
||||||
|
_GBASDLHandleKeypress(context, &event.key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
pthread_mutex_lock(&renderer->d.mutex);
|
pthread_mutex_lock(&renderer->d.mutex);
|
||||||
pthread_cond_broadcast(&renderer->d.downCond);
|
pthread_cond_broadcast(&renderer->d.downCond);
|
||||||
pthread_mutex_unlock(&renderer->d.mutex);
|
pthread_mutex_unlock(&renderer->d.mutex);
|
||||||
|
@ -144,18 +157,6 @@ static void _GBASDLRunloop(struct GBAThread* context, struct GLSoftwareRenderer*
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&renderer->d.mutex);
|
pthread_mutex_unlock(&renderer->d.mutex);
|
||||||
}
|
}
|
||||||
while (SDL_PollEvent(&event)) {
|
|
||||||
switch (event.type) {
|
|
||||||
case SDL_QUIT:
|
|
||||||
// FIXME: this isn't thread-safe
|
|
||||||
context->debugger->state = DEBUGGER_EXITING;
|
|
||||||
break;
|
|
||||||
case SDL_KEYDOWN:
|
|
||||||
case SDL_KEYUP:
|
|
||||||
_GBASDLHandleKeypress(context, &event.key);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue