Skip to content

Commit

Permalink
Fix for queueing events, compliments of Rasmus Goransson.
Browse files Browse the repository at this point in the history
His email:

Hello!

I've been playing around with ManyMouse and I think I've found a little
bug in the queue_event function in windows_wminput.c. The newest message
is written after the index is incremented which stops the newest event
from being read. It also leaves the first event being empty.

Isn't it supposed to be like this?

[code snipped, see subversion repository for patch. --ryan.]

--
Rasmus Goransson
Sweden
"You are unique, just like everyone else"
  • Loading branch information
icculus committed Sep 18, 2005
1 parent 47707cc commit 317251a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions windows_wminput.c
Expand Up @@ -240,6 +240,9 @@ static int find_api_symbols(void)

static void queue_event(const ManyMouseEvent *event)
{
/* copy the event info. We'll process it in ManyMouse_PollEvent(). */
CopyMemory(&input_events[input_events_write], event, sizeof (ManyMouseEvent));

input_events_write = ((input_events_write + 1) % MAX_EVENTS);

/* Ring buffer full? Lose oldest event. */
Expand All @@ -248,9 +251,6 @@ static void queue_event(const ManyMouseEvent *event)
/* !!! FIXME: we need to not lose mouse buttons here. */
input_events_read = ((input_events_read + 1) % MAX_EVENTS);
} /* if */

/* copy the event info. We'll process it in ManyMouse_PollEvent(). */
CopyMemory(&input_events[input_events_write], event, sizeof (ManyMouseEvent));
} /* queue_event */


Expand Down

0 comments on commit 317251a

Please sign in to comment.