changeset 33018:d88b8a9e989e

Change condition to avoid needless key state resets with very small key fifos.
author reimar
date Thu, 24 Mar 2011 22:28:17 +0000
parents cc8cef372901
children 03ed899a72bc
files mp_fifo.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mp_fifo.c	Thu Mar 24 22:11:18 2011 +0000
+++ b/mp_fifo.c	Thu Mar 24 22:28:17 2011 +0000
@@ -33,7 +33,8 @@
     key_fifo_data = malloc(key_fifo_size * sizeof(int));
   if(!fifo_free) return; // FIFO FULL!!
   // reserve some space for key release events to avoid stuck keys
-  if((code & MP_KEY_DOWN) && fifo_free < (key_fifo_size >> 1))
+  // Make sure we do not reset key state because of a down event
+  if((code & MP_KEY_DOWN) && fifo_free <= (key_fifo_size >> 1))
     return;
   // in the worst case, just reset key state
   if (fifo_free == 1)