diff mp_fifo.c @ 33017:cc8cef372901

Make "stuck keys" problem impossibly by resetting the internal key state when our key fifo overflowed.
author reimar
date Thu, 24 Mar 2011 22:11:18 +0000
parents 88a7bd86e3ac
children d88b8a9e989e
line wrap: on
line diff
--- a/mp_fifo.c	Thu Mar 24 21:58:06 2011 +0000
+++ b/mp_fifo.c	Thu Mar 24 22:11:18 2011 +0000
@@ -35,6 +35,9 @@
   // reserve some space for key release events to avoid stuck keys
   if((code & MP_KEY_DOWN) && fifo_free < (key_fifo_size >> 1))
     return;
+  // in the worst case, just reset key state
+  if (fifo_free == 1)
+    code = MP_KEY_RELEASE_ALL;
   key_fifo_data[key_fifo_write % key_fifo_size]=code;
   key_fifo_write++;
 }