summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sdl_fb.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/sdl_fb.c b/src/sdl_fb.c
index 52cf556..b663848 100644
--- a/src/sdl_fb.c
+++ b/src/sdl_fb.c
@@ -120,10 +120,31 @@ static int sdl_fb_page_free(void *context, void *page)
}
+static int sdl_ready()
+{
+ SDL_Event ev;
+
+ /* It's important on Windows in particular to
+ * drain the event queue vs. just SDL_QuitRequested()
+ */
+ while (SDL_PollEvent(&ev)) {
+ if (ev.type == SDL_QUIT)
+ return -EPIPE;
+ }
+
+ return 0;
+}
+
+
static int sdl_fb_page_flip(void *context, void *page)
{
sdl_fb_t *c = context;
sdl_fb_page_t *p = page;
+ int r;
+
+ r = sdl_ready();
+ if (r < 0)
+ return r;
if (SDL_UpdateTexture(c->texture, NULL, p->surface->pixels, p->surface->pitch) < 0)
return -1;
@@ -136,9 +157,6 @@ static int sdl_fb_page_flip(void *context, void *page)
SDL_RenderPresent(c->renderer);
- if (SDL_QuitRequested())
- return -EPIPE;
-
return 0;
}
© All Rights Reserved