aboutsummaryrefslogtreecommitdiffhomepage
path: root/input
Commit message (Collapse)AuthorAge
...
* input: fix missed wakeups, simplifyGravatar wm42014-09-09
| | | | | mp_input_read_cmd() reset the wakeup flag, but only mp_input_wait() should be able to do that.
* input: fix use after free with legacy commandsGravatar wm42014-09-08
| | | | | | | | To handle legacy commands, string replacement is used; the modified string is returned by parse_cmd_str(), but it also frees all temporary memory, which includes the replaced string. Closes #1075.
* input: fix exiting with signalsGravatar wm42014-09-08
| | | | | Quitting through SIGTERM etc. was accidentally ignored since commit f5af5962 from today.
* player: some more input refactoringGravatar wm42014-09-07
| | | | | | | | | | | | | | | | | Continues commit 348dfd93. Replace other places where input was manually fetched with common code. demux_was_interrupted() was a weird function; I'm not entirely sure about its original purpose, but now we can just replace it with simpler code as well. One difference is that we always look at the command queue, rather than just when cache initialization failed. Also, instead of discarding all but quit/playlist commands (aka abort command), run all commands. This could possibly lead to unwanted side-effects, like just ignoring commands that have no effect (consider pressing 'f' for fullscreen right on start: since the window is not created yet, it would get discarded). But playlist navigation still works as intended, and some if not all these problems already existed before that in some forms, so it should be ok.
* input: make ar_rate and ar_delay fields of input_ctx signedGravatar shdown2014-08-30
| | | | | ar_rate is set to -1 when autorepeat is disabled; there is no reason for ar_delay to stay unsigned.
* input: handle reaching MP_MAX_FDS correctlyGravatar shdown2014-08-30
| | | | Don't dereference fd and increment ictx->num_fds on fail.
* Move compat/ and bstr/ directory contents somewhere elseGravatar wm42014-08-29
| | | | | | | | | bstr.c doesn't really deserve its own directory, and compat had just a few files, most of which may as well be in osdep. There isn't really any justification for these extra directories, so get rid of them. The compat/libav.h was empty - just delete it. We changed our approach to API compatibility, and will likely not need it anymore.
* posix: use STD*_FILENO constantsGravatar Ben Boeckel2014-08-28
| | | | | Rather than "magic" numbers, use meaningful constant names provided by unistd.h.
* input: make key bindings like "Shift+X" work (for ASCII)Gravatar wm42014-08-26
| | | | | | | | | | | | | | "Shift+X" didn't actually map any key, as opposed to "Shift+x". This is because shift usually changes the case of a character, so a plain printable character like "X" simply can never be combined with shift. But this is not very intuitive. Always remove the shift code from printable characters. Also, for ASCII, actually apply the case mapping to uppercase characters if combined with shift. Doing this for unicode in general would be nice, but that would require lookup tables. In general, we don't know anyway what character a key produces when combined with shift - it could be anything, and depends on the keyboard layout.
* input: make all modifier flags unsignedGravatar wm42014-08-26
|
* input: stdin is 0, not 1Gravatar wm42014-08-25
| | | | Oops. I can never remember this right.
* input: redo how --input-file is handledGravatar wm42014-08-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | Abandon the "old" infrastructure for --input-file (mp_input_add_fd(), select() loop, non-blocking reads). Replace it with something that starts a reader thread, using blocking input. This is for the sake of Windows. Windows is a truly insane operating system, and there's not even a way to read a pipe in a non-blocking way, or to wait for new input in an interruptible way (like with poll()). And unfortunately, some want to use pipe to send input to mpv. There are probably (slightly) better IPC mechanisms available on Windows, but for the sake of platform uniformity, make this work again for now. On Vista+, CancelIoEx() could probably be used. But there's no way on XP. Also, that function doesn't work on wine, making development harder. We could forcibly terminate the thread, which might work, but is unsafe. So what we do is starting a thread, and if we don't want the pipe input anymore, we just abandon the thread. The thread might remain blocked forever, but if we exit the process, the kernel will forcibly kill it. On Unix, just use poll() to handle this. Unfortunately the code is pretty crappy, but it's ok, because it's late and I wanted to stop working on this an hour ago. Tested on wine; might not work on a real Windows.
* input: change verbosity of some message levelsGravatar wm42014-08-25
| | | | | | | For --input-test, print messages on terminal by default. Raise message level for enabling input sections, because the OSC makes this very extremely annoying.
* input: fix event wakeupGravatar wm42014-08-11
| | | | | | | | 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 parserGravatar wm42014-08-07
| | | | Should fix #989.
* input: be stricter about rejecting mouse input with --no-input-cursorGravatar wm42014-07-27
| | | | | | | 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() wrapperGravatar wm42014-07-27
| | | | So that VO backends don't have to access the VO just for that.
* vo: different hack for VOs which need to mangle mouse inputGravatar wm42014-07-27
| | | | | | | | 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 positiveGravatar wm42014-07-25
| | | | | Apparently this is not necessarily the case, so just drop the silly idea that depended on this assumption.
* command: add append-play loadfile modeGravatar wm42014-07-23
| | | | | | | | "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 socketGravatar foo862014-07-20
| | | | | Commit dc00b14 removed playloop polling. Enable wakeup on LIRC socket, otherwise remote control doesn't work when paused.
* input: skip BOM in input.confGravatar wm42014-07-12
|
* build: include <strings.h> for strcasecmp()Gravatar wm42014-07-10
| | | | | | | 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 buttonsGravatar wm42014-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 usesGravatar wm42014-07-01
| | | | | | | | | | | | | | | | 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 localGravatar wm42014-06-11
| | | | | | | | | 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 commandsGravatar wm42014-06-11
| | | | | | | | | | | | | | | | | | 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 commandsGravatar wm42014-06-06
| | | | I don't really see a reason for this.
* input: separate wakeup pipe creation into a separate functionGravatar wm42014-05-30
| | | | | Error handling is slightly reduced: we assume that setting a pipe to non-blocking can never fail.
* input: make combined commands repeatableGravatar wm42014-05-26
| | | | | | | | 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 commandGravatar Martin2014-05-26
| | | | | | Closes #808. Signed-off-by: wm4 <wm4@nowhere>
* player: give quit_watch_later an exit code argument like quitGravatar wm42014-05-22
| | | | | | | | 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-draggingGravatar wm42014-05-20
| | | | Requested in github issue #608.
* input: fix compilation on windowsGravatar wm42014-05-20
| | | | | 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 prefixesGravatar wm42014-05-11
| | | | | | 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, cosmeticsGravatar wm42014-05-10
|
* options: rename input-related optionsGravatar Martin Herkt2014-05-04
| | | | | | | | | | | --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 cmdGravatar wm42014-05-02
| | | | | | 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 sectionsGravatar wm42014-05-02
| | | | | | | This is because Lua scripts creating key bindings create 2 input sections per script. Probably fixes #759.
* input: fix mouse_leave/OSC behaviorGravatar wm42014-04-26
| | | | | | | | | 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 conditionGravatar wm42014-04-26
| | | | | | 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-safeGravatar wm42014-04-25
| | | | | | | | | | | | | | | | 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 variablesGravatar wm42014-04-25
| | | | | | | | | | | | 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 againGravatar wm42014-04-19
| | | | | | | | | | | | | | | 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 mappedGravatar wm42014-04-19
| | | | | | 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 duplicationGravatar wm42014-04-19
|
* input: ignore modifiers on MOUSE_LEAVEGravatar wm42014-04-19
| | | | Just in case something adds shift/alt/ctrl state to it.
* input: don't wakeup core if key repeat is requested but not possibleGravatar wm42014-04-18
| | | | There's no need to wakeup the core in this situation.
* input: remove minor redundancyGravatar wm42014-04-18
|
* input: keycodes: reorder flagsGravatar wm42014-04-18
| | | | | | | 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.