and does not cause a positive return from mouse_trywait() This was causing phantom mouse events. Since mouse_pending() still returns the number of mouse events, use mouse_trywait() in curs_cio.c to check if a mouse key is pending.