mpv/input
Uoti Urpala 82b8f89bae input: rework event reading and command queuing
Rework much of the logic related to reading from event sources and
queuing commands. The two biggest architecture changes are:
- The code buffering keycodes in mp_fifo.c is gone. Instead key input
  is now immediately fed to input.c and interpreted as commands, and
  then the commands are buffered instead.
- mp_input_get_cmd() now always tries to read every available event
  from every event source and convert them to (buffered) commands.
  Before it would only process new events until one new command became
  available.

Some relevant behavior changes:
- Before commands could be lost when stream code called
  mp_input_check_interrupt() which read commands (to see if they were
  of types that triggered aborts during slow IO tasks) and then threw
  them away. This was especially an issue if cache was enabled and slow
  to read. Fixed - now it's possible to check whether there are queued
  commands which will abort playback of the current file without
  throwing other commands away.
- mp_input_check_interrupt() now prints a message if it returns
  true. This is especially useful because the failures caused by
  aborted stream reads can trigger error messages from other code that
  was doing the read; the new message makes it more obvious what the
  cause of the subsequent error messages is.
- It's now possible to again avoid making stdin non-blocking (which
  caused some issues) without reintroducing extra latency. The change
  will be done in a subsequent commit.
- Event sources that do not support select() should now have somewhat
  lower latency in certain situations as they will be checked both
  before and after select()/sleep in input reading; before the sleep
  always happened first even if such sources already had queued
  input. Before the key fifo was also handled in this manner (first
  key triggered select, but if multiple were read then rest could be
  delayed; however in most cases this didn't add latency in practice
  as after central code started doing command handling it queried for
  further commands with a max sleep time of 0).
- Key fifo limiting is more accurate now: it now counts actual
  commands intead of keycodes, and all queued keys are read
  immediately from input devices so they can be counted correctly.
- Since keypresses are now interpreted immediately, commands which
  change keybindings will no longer affect following keypresses that
  have already been read before the command is executed. This should
  not be an issue in practice with current keybinding behavior.
2011-07-17 07:36:09 +03:00
..
appleir.c input: move all key code lists to input/keycodes.h 2011-05-02 00:43:31 +03:00
ar.c cleanup: remove some unnecessary input.[ch] typedefs 2011-07-16 21:32:37 +03:00
ar.h cleanup: remove some unnecessary input.[ch] typedefs 2011-07-16 21:32:37 +03:00
input.c input: rework event reading and command queuing 2011-07-17 07:36:09 +03:00
input.h input: rework event reading and command queuing 2011-07-17 07:36:09 +03:00
joystick.c input/joystick.c: add #include missing from 23cb829072 2011-05-03 13:26:30 +03:00
joystick.h input: move all key code lists to input/keycodes.h 2011-05-02 00:43:31 +03:00
keycodes.h input: support up to 20 mouse buttons 2011-06-29 07:46:58 +03:00
lirc.c cleanup: remove some unnecessary input.[ch] typedefs 2011-07-16 21:32:37 +03:00
lirc.h cleanup: remove some unnecessary input.[ch] typedefs 2011-07-16 21:32:37 +03:00