From f95aed2624e40d5e5a099e0918329d5362fee344 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Wed, 9 Mar 2022 17:47:35 +0100 Subject: sdl-1.2/mouse.c: fix right click events --- src/mouse/sdl-1.2/src/mouse.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') 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", -- cgit v1.2.3