aboutsummaryrefslogtreecommitdiff
path: root/src/mouse
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-03-09 17:47:35 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-03-30 08:20:21 +0200
commitf95aed2624e40d5e5a099e0918329d5362fee344 (patch)
treee7295240b7a3de42595d888d32b3a39c9c8a8e50 /src/mouse
parent94690d69c11937386450ca77746d9f719f2a1509 (diff)
downloadrts-f95aed2624e40d5e5a099e0918329d5362fee344.tar.gz
sdl-1.2/mouse.c: fix right click events
Diffstat (limited to 'src/mouse')
-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",