aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mouse/sdl-1.2/src/mouse.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mouse/sdl-1.2/src/mouse.c b/src/mouse/sdl-1.2/src/mouse.c
index 381ac0e..a0a6d90 100644
--- a/src/mouse/sdl-1.2/src/mouse.c
+++ b/src/mouse/sdl-1.2/src/mouse.c
@@ -53,7 +53,12 @@ void mouse_update(struct mouse *const m)
/* Fall through. */
case SDL_MOUSEBUTTONUP:
mouse_click(&ev.button, m);
- break;
+ /* SDL_PeepEvents might return both pressed and released
+ * button events on the same cycle, but this library only
+ * expects one event at a time.
+ * Contrarily, all available SDL_MOUSEMOTION events must
+ * be treated simultaneously to avoid latency. */
+ goto end;
case SDL_MOUSEMOTION:
mouse_event(&ev.motion, m);
@@ -66,6 +71,8 @@ void mouse_update(struct mouse *const m)
}
}
+end:
+
if (n < 0)
{
fprintf(stderr, "%s: SDL_PeepEvents: %s\n",