summaryrefslogtreecommitdiffstats
path: root/input
Commit message (Collapse)AuthorAgeFilesLines
* input: fix event wakeupwm42014-08-111-18/+14
| | | | | | | | When a new event was added, merely a flag was set, instead of actually waking up the core (if needed). This was ok in ancient times when all event sources were part of the select() loop. But now there are several cases where other threads can add input, and then you actually need to wakeup the core in order to make it read the events at all.
* input: fix off by one error in command parserwm42014-08-071-1/+1
| | | | Should fix #989.
* input: be stricter about rejecting mouse input with --no-input-cursorwm42014-07-272-0/+5
| | | | | | | Apparently this switch means all mouse input should be strictly rejected. Some VO backends (such as X11) explicitly disable all mouse events if this option is set, but others don't. So check them in input.c, which increases consistency.
* vo: remove vo_mouse_movement() wrapperwm42014-07-272-0/+21
| | | | So that VO backends don't have to access the VO just for that.
* vo: different hack for VOs which need to mangle mouse inputwm42014-07-272-0/+36
| | | | | | | | Follow up on commit 760548da. Mouse handling is a bit confusing, because there are at least 3 coordinate systems associated with it, and it should be cleaned up. But that is hard, so just apply a hack which gets the currently-annoying issue (VO backends needing access to the VO) out of the way.
* osdep: don't assume errno is positivewm42014-07-251-1/+1
| | | | | Apparently this is not necessarily the case, so just drop the silly idea that depended on this assumption.
* command: add append-play loadfile modewm42014-07-231-1/+2
| | | | | | | | "loadfile filename append-play" will now always append the file to the playlist, and if nothing is playing yet, start playback. I don't want to change the semantics of "append" mode, so a new mode is needed. Probably fixes issue #950.
* input: enable wakeup on LIRC socketfoo862014-07-201-1/+1
| | | | | Commit dc00b14 removed playloop polling. Enable wakeup on LIRC socket, otherwise remote control doesn't work when paused.
* input: skip BOM in input.confwm42014-07-121-0/+1
|
* build: include <strings.h> for strcasecmp()wm42014-07-101-0/+1
| | | | | | | It happens to work without strings.h on glibc or with _GNU_SOURCE, but the POSIX standard requires including <strings.h>. Hopefully fixes OSX build.
* input: restore ability to combine mouse buttonswm42014-07-071-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Key bindings are decided on the "down" event, so if the prefix is not unique, the first/shortest will be used (e.g. when both "a" and "a-b" are mapped, "a" will always be chosen). This also breaks combining multiple mouse buttons. But it seems users expect it to work, and it's indeed a bit strange that it shouldn't work, as mouse bindings are emitted on the key "up" event, not "down" (if the shorter binding didn't emit a command yet, why shouldn't it be combinable). Deal with this by clearing the key history when a command is actually emitted, instead of when a command is decided. This means if both MOUSE_BTN0 and MOUSE_BTN0-MOUSE_BTN1 are mapped, the sequence of holding down BTN0 and then BTN1 will redecide the current command. On the other hand, if BTN0 is released before BTN1 is pressed, the command is emitted, and the key history is deleted. So the BTN1 press will not trigger BTN0-BTN1. For normal keys, nothing should change, because commands are emitted on the "down" event already, so the key history is always cleared. Might fix #902. CC: @mpv-player/stable (if this fix is successful)
* Audit and replace all ctype.h useswm42014-07-011-1/+0
| | | | | | | | | | | | | | | | Something like "char *s = ...; isdigit(s[0]);" triggers undefined behavior, because char can be signed, and thus s[0] can be a negative value. The is*() functions require unsigned char _or_ EOF. EOF is a special value outside of unsigned char range, thus the argument to the is*() functions can't be a char. This undefined behavior can actually trigger crashes if the implementation of these functions e.g. uses lookup tables, which are then indexed with out-of-range values. Replace all <ctype.h> uses with our own custom mp_is*() functions added with misc/ctype.h. As a bonus, these functions are locale-independent. (Although currently, we _require_ C locale for other reasons.)
* input: make option struct localwm42014-06-111-27/+56
| | | | | | | | | Similar to previous commits. This also renames --doubleclick-time to --input-doubleclick-time, and --key-fifo-size to --input-key-fifo-size. We could keep the old names, but these options are very obscure, and renaming them seems better for consistency.
* command: redo ancient TV/DVB/PVR commandswm42014-06-112-21/+0
| | | | | | | | | | | | | | | | | | Convert all these commands to properties. (Except tv_last_channel, not sure what to do with this.) Also, internally, don't access stream details directly, but dispatch commands with stream ctrls. Many of the new properties are a bit strange, because they're write- only. Also remove some OSD output these commands produced, because I couldn't be bothered to port these. In general, this makes everything much cleaner, and will also make it easier to e.g. move the demuxer to its own thread. Don't bother updating input.conf, but changes.rst documents how old commands map to the new ones. Mostly untested, due to lack of hardware.
* input: don't print warning when aboting playback via commandswm42014-06-061-6/+1
| | | | I don't really see a reason for this.
* input: separate wakeup pipe creation into a separate functionwm42014-05-301-13/+2
| | | | | Error handling is slightly reduced: we assume that setting a pipe to non-blocking can never fail.
* input: make combined commands repeatablewm42014-05-263-2/+10
| | | | | | | | Binding multiple commands at once where always considered not repeatable, because the MP_CMD_COMMAND_LIST wasn't considered repeatable. Fixes #807 (probably).
* command: add write_watch_later_config commandMartin2014-05-262-0/+4
| | | | | | Closes #808. Signed-off-by: wm4 <wm4@nowhere>
* player: give quit_watch_later an exit code argument like quitwm42014-05-221-1/+1
| | | | | | | | The quit command has an optional argument that is used as exit code. Extend that to the quit_watch_later command. Actually, unify the implementations of the two commands. Requested in #798.
* input: allow disabling window dragging with --no-window-draggingwm42014-05-201-1/+7
| | | | Requested in github issue #608.
* input: fix compilation on windowswm42014-05-201-4/+2
| | | | | Currently I don't have a crosscompilation toolchain, so I couldn't test whether this actually compiles (and still can't).
* input: remove pausing command prefixeswm42014-05-112-5/+0
| | | | | | These are now equivalent to combining commands with the "cycle pause" or "set pause" commands, and thus are not needed anymore. They were also obscure and undocumented.
* input: fix typos, cosmeticswm42014-05-101-10/+10
|
* options: rename input-related optionsMartin Herkt2014-05-041-7/+7
| | | | | | | | | | | --ar → --input-appleremote --consolecontrols → --input-terminal --media-keys → --input-media-keys --joystick → --input-joystick --lirc → --input-lirc --lircconf → --input-lirc-conf --mouse-movements → --input-cursor --right-alt-gr → --input-right-alt-gr
* input: fix stack overflow when checking for abort cmdwm42014-05-021-1/+1
| | | | | | This can happen when the input stream is somehow blocking on network, and the user still send input in one way or another, and one of the commands is a compound command ("cmd a ; cmd b").
* input: increase number of maximum sectionswm42014-05-021-1/+1
| | | | | | | This is because Lua scripts creating key bindings create 2 input sections per script. Probably fixes #759.
* input: fix mouse_leave/OSC behaviorwm42014-04-261-1/+1
| | | | | | | | | This essentially reverts commit cca13efb. The code in the if was supposed to be run only if the mouse button was down, because in this case the mouse area is never considered to be left. Since it was run for every mouse button, mouse_leave wasn't sent. Fixes #745.
* input: fix inverted conditionwm42014-04-261-1/+1
| | | | | | pthread_equal() returns 0 if the threads are not the same, and somehow I got that wrong. The worst is that I actually explicitly checked the manpage when I wrote this code.
* stream: make mp_input_check_interrupt thread-safewm42014-04-252-2/+13
| | | | | | | | | | | | | | | | The interrupt callback will can be called from another thread if the cache is enabled, and the stream disconnects. Then stream_reconnect() will call this function from within the cache thread. mp_input_check_interrupt() is not thread-safe due to read_events() not being thread-safe. It will call input callbacks added with mp_input_add_fd() - these callbacks lead to code not protected by locks, such as reading X11 events. Solve this by adding a stupid hack, which checks whether the calling thread is the main playback thread (i.e. calling the input callbacks will be safe). We can remove this hack later, but it requires at least moving the VO to its own thread first.
* stream: remove interrupt callback global variableswm42014-04-252-6/+3
| | | | | | | | | | | | This used global variables for the asynchronous interrupt callback. Pick the simple and dumb solution and stuff the callback into mpv_global. Do this because interrupt checking should also work in the connect phase, and currently stream creation equates connecting. Ideally, this would be passed to the stream on creation instead, or connecting would be separated from creation. But since I don't know yet which is better, and since moving stream/demuxer into their own thread is something that will happen later, go with the mpv_global solution.
* input: make key binds order-independent againwm42014-04-191-2/+7
| | | | | | | | | | | | | | | This is for the sake of multi-key commands again. This could break: SPACE ignore SPACE-SPACE command while this worked: SPACE-SPACE command SPACE ignore The reason being that if the shorter command was first in the list, it would obviously match, and searching was stopped.
* input: discard key history when a key is mappedwm42014-04-191-3/+7
| | | | | | This is for the sake of multi-key combinations (see github issue #718). Now a multi-key sequence isn't matched if any of the previous keys were actually mapped.
* input: remove minor code duplicationwm42014-04-191-15/+16
|
* input: ignore modifiers on MOUSE_LEAVEwm42014-04-191-2/+2
| | | | Just in case something adds shift/alt/ctrl state to it.
* input: don't wakeup core if key repeat is requested but not possiblewm42014-04-181-7/+5
| | | | There's no need to wakeup the core in this situation.
* input: remove minor redundancywm42014-04-181-10/+2
|
* input: keycodes: reorder flagswm42014-04-181-16/+16
| | | | | | | MP_KEY_EMIT_ON_UP and MP_NO_REPEAT_KEY are not modifiers, just static flags that some keycodes set. This is just a cosmetic change.
* input: simplify by not tracking key up/down stateswm42014-04-181-53/+30
| | | | | | | | | We only need to track key up/down for a single key. There may be some minor loss of robustness, but this can (probably) happen only if a VO or user sends strange or complicated sequences of events. In the normal case, what we do is more than enough. Most simplification comes from the fact that mpv is not a game console, and users normally execute only one action at once.
* input: rename a variablewm42014-04-181-5/+5
| | | | Squashing this with the following commit would be confusing.
* input: slightly simplify mouse dispatchingwm42014-04-181-13/+1
| | | | | I admit I don't really understand anymore why this was needed. Delete it anyway. It was added with commit 42fa7cbbf.
* input: move a functionwm42014-04-181-11/+11
|
* input: close window when window close button is pressed with --input-testwm42014-04-181-0/+9
| | | | | | | | | | | The window close button is usually mapped to the CLOSE_WIN pseudo-key. Until now, --input-test treated this pseudo-key like any other key (like the rest of the input handling code), so you couldn't close the window in this mode. The manpage had silly instructions and warnings how to deal with this. Just always quit when CLOSE_WIN is received, and improve the instructions.
* input: handle multi-combinations as key sequenceswm42014-04-181-64/+50
| | | | | | | | | | | | | | | | | The input code always supported combinations of multiple keys (even in MPlayer, although there the code was active really only for mouse buttons). This was arcance and also made the code more complicated. I only know of a single person who ever made use of this feature. Remove this feature, and repurpose some of the support code (e.g. parsing, display of key combinations, etc.) to handle such multi- combinations as sequences, instead of keys to be pressed at the same time. This is much simpler and implements the feature requested in github issue #718. This commit will probably cause a bunch of regressions, since the input handling code has some weird corner cases. I couldn't find any problems when testing, though.
* input: deal with playback thread wakeup on windowswm42014-04-151-3/+14
| | | | | | | | | | | | | The recent change of waking up the playback thread using a wakeup pipe doesn't work on windows, because windows is horrible. So use a condition variable instead to wake up the thread. To make things worse, jackaudio is also horrible and "disallows" the use of mutexes, so all we can do is implementing a half-solution that is not race condition free. It would probably better to give up on this lock-free crap in the pull- API audio path. Mostly untested.
* audio: wake up the core when audio buffer is running low (2)wm42014-04-152-0/+8
| | | | | | | | | | | | | | Same change as in e2184fcb, but this time for pull based AOs. This is slightly controversial, because it will make a fast syscall from e.g. ao_jack. And according to JackAudio developers, syscalls are evil and will destroy realtime operation. But I don't think this is an issue at all. Still avoid locking a mutex. I'm not sure what jackaudio does in the worst case - but if they set the jackaudio thread (and only this thread) to realtime, we might run into deadlock situations due to priority inversion and such. I'm not quite sure whether this can happen, but I'll readily follow the cargo cult if it makes hack happy.
* Kill all tabswm42014-04-132-20/+20
| | | | | | | | | | | I hate tabs. This replaces all tabs in all source files with spaces. The only exception is old-makefile. The replacement was made by running the GNU coreutils "expand" command on every file. Since the replacement was automatic, it's possible that some formatting was destroyed (but perhaps only if it was assuming that the end of a tab does not correspond to aligning the end to multiples of 8 spaces).
* joystick: Fix incorrect pointer offset code.reimar2014-04-101-1/+1
| | | | | | | I have some doubts that short reads are even allowed/ possible for /dev/js*, does someone know for sure? git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@37132 b3059339-0415-0410-9bf9-f77b7e298cf2
* player: rename dvdnav to discnavxylosper2014-03-302-2/+3
| | | | | Now, navigation works both of DVD and non-BD-J Blu-ray. Therefore, rename all 'dvdnav' strings which are not DVD specific to 'discnav'
* command, lua: change script_message semanticswm42014-03-172-1/+3
| | | | | | | | Change script_message to broadcast the message to all clients. Add a new script_message_to command, which does what the old script_message command did. This is intended as simplification, although it might lead to chaos too.
* input: allow input.conf bindings to be declared as builtinwm42014-02-251-0/+11
| | | | | | This might be helpful if we ever want cascading config files. Also, we will probably need it if we change the default input.conf bindings, and want to provide compatibility input.conf files.
* command: fix loadfile commandwm42014-02-243-3/+6
| | | | | | | | | | | | | | | This was broken by commit bb6b543812a724. Note that the original pull request was fine, but it was broken by my own stupidity when I was "improving" it. The problem is that the new loadfile argument was not considered optional anymore after my changes. The original pull request did handle this by setting .defval to a dummy value, but I removed that part. Fix it again by introducing a flag that designates that the parameter is optional. (I didn't want to add it to m_option.h, because technically, all options are optional, and it's not possible to have non-optional options.)
* command: provide per-file-options for loadfile commandxylosper2014-02-232-0/+2
| | | | | | Signed-off-by: wm4 <wm4@nowhere> Closes #575. Minor changes over original pull request.
* command: remove special casing for strings in input commandswm42014-02-231-5/+13
| | | | | | Until now, strings were the only allowed dynamically allocated argument type in input commands. Extend it so that it works for any type. (The string expansion in command.c is of course still string specific.)
* input: check for abort cmd in multi-commandswm42014-02-203-4/+19
| | | | | | | | | MP_CMD_COMMAND_LIST commands (used to implement key bindings with multiple commands) were not checked for abort commands. Implement it. Remove the remarks about multi-commands being special from the manpage. Seek coalescing is handled differently now, and the issue with abort commands is fixed with this commit.
* input: ignore modifiers when releasing keysJames Ross-Gowan2014-02-201-2/+2
| | | | | This prevents keys from getting stuck if the modifier is released before the base key.
* input, dvdnav: fix osc stealing input from dvdnavwm42014-02-192-4/+16
| | | | | | | | | | This is a regression introduced from moving Lua scripts (including the OSC) to their own threads. Now OSC and dvdnav can add their bindings at the same time without coordination, which seems to result in the OSC winning most time, and thus overriding the dvdnav menu bindings. Fix this by adding a flag that makes dvdnav menu bindings take priority over all other bindings.
* input: minor simplification for --input-testwm42014-02-191-5/+4
|
* input: debug output for registered bindingswm42014-02-171-0/+7
|
* input: don't let builtin bindings overwrite user bindingswm42014-02-171-2/+6
| | | | | This was already done, except when the bindings were in different input sections. This commit fixed it. Useful for scripts, probably.
* client API: add a client message eventwm42014-02-172-0/+3
| | | | | This comes with a "script_message" input command, which sends these messages. Used by the following commits.
* keycodes: add const to a function argumentwm42014-02-172-2/+2
|
* threads: add wrapper for initializing recursive mutexeswm42014-01-311-5/+2
| | | | Damn this overly verbose pthread API.
* input: change mp_input_run_cmd signaturewm42014-01-043-8/+6
| | | | | | | | I don't like this function at all, but it's basically a trick to get the input's mp_log instance in a case the mp_input_parse_cmd_strv() is almost certainly not going to output anything. But still make it somewhat more consistent with mp_input_parse_cmd_strv() - why force the caller to always use MP_ON_OSD_AUTO?
* video/out: remove some code duplication between X11 and waylandwm42014-01-042-0