summaryrefslogtreecommitdiffstats
path: root/mp_fifo.c
Commit message (Collapse)AuthorAgeFilesLines
* input: allow unicode keys and reassign internal key codeswm42012-01-181-0/+10
| | | | | | | | | | This moves all key codes above the highest valid unicode code point (which is 0x10FFFF). All key codes below MP_KEY_BASE now directly map to unicode. Configuration files (input.conf) can contain unicode characters in UTF-8 to map non-ASCII characters/keys. This shouldn't change anything user visible, except that "direct key codes" (as used in input.conf) will change their meaning.
* input: rework event reading and command queuingUoti Urpala2011-07-171-68/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* input: rewrite -key-fifo-size limiting logicUoti Urpala2011-05-021-16/+53
| | | | | | | | | | | | | | | | | | Instead of strictly limiting the number of total entries in the internal fifo, make the overall buffer bigger and try to limit entries based on how many bound commands they're expected to generate. Now doubleclick and button down events aren't counted for that limit. Normally the sequence down-doubleclick-up generates at most one command, so this better matches the quantity we actually want to limit. Also add a mechanism to clear the button combination state kept by input.c when the fifo is full; this avoids "stuck button" problems due to button release events being dropped. The key combination state clearing is partially based on MPlayer 1 changes by Reimar Döffinger (though overall the effects of this commit are quite different). It still doesn't make "stuck button" problems completely impossible; at least if the VO gets closed while a button was down then nothing will send a button up event or reset state.
* input: modify interpretation of doubleclick eventsUoti Urpala2011-05-021-12/+6
| | | | | | | | | | | | | The code combining button presses into multibutton commands prevented single click commands from triggering if a doubleclick event had been generated from the same button press. As a result using the mouse wheel to seek worked very badly. Special-case doubleclick events in the event interpretation code to avoid this issue. This changes the sequence of generated "keys" for press-release-press-release from MOUSE_BTN0 MOUSE_BTN0-MOUSE_BTN0_DBL MOUSE_BTN0_DBL to MOUSE_BTN0 MOUSE_BTN0_DBL MOUSE_BTN0. "Keys" like MOUSE_BTN0-MOUSE_BTN0_DBL will never be generated now; any existing configuration files using those need to be changed.
* input: move all key code lists to input/keycodes.hUoti Urpala2011-05-021-3/+3
| | | | | | | | | | | | | Move the definitions of all special key codes (those not passed by ASCII value) to input/keycodes.h. Before they were spread between osdep/keycodes.h, input/joystick.h, input/mouse.h and input/ar.h, plus some special values in input.h. This was especially inconvenient as the codes had to be coordinated to not conflict between the files. The change requires a bit of ugliness as appleir.c includes <linux/input.h> which contains various conflicting KEY_* definitions. Work around this by adding a special preprocessor variable which can be used to avoid defining these in keycodes.h.
* Merge svn changes up to r30475Uoti Urpala2010-03-091-0/+18
|\
| * Add license header to all top-level files missing them.diego2010-01-301-0/+18
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30471 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Move key_fifo_size & doubleclick_time to options structUoti Urpala2008-04-291-6/+6
| |
* | Add a context for mp_fifoUoti Urpala2008-04-291-50/+61
| | | | | | | | | | Store data in an allocated context and take it as an argument instead of using static variables.
* | mp_fifo.c, osdep/: Include corresponding .h in .c filesUoti Urpala2008-04-291-0/+1
| |
* | input: Remove separate mp_input_add_event_fdUoti Urpala2008-04-291-1/+2
|/ | | | | | | | Use the same mp_input_add_key_fd for all uses and add a context argument to its callback that was before only in the event fd callbacks. Instead of checking in input.c whether keys were inserted to the keypress FIFO during the callback do the check in the callback before returning and set return value accordingly.
* Code cleanup: don't include a .c file in mplayer.c and fix a fewrathann2007-03-291-0/+70
"implicit declaration of function ‘mplayer_put_key’" warnings Based on Attila's suggestions. Approved by Uoti and Ivan. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22841 b3059339-0415-0410-9bf9-f77b7e298cf2