summaryrefslogtreecommitdiffstats
path: root/mpvcore/input
Commit message (Collapse)AuthorAgeFilesLines
* input: fix --input-ar-rate=0wm42013-10-201-1/+1
| | | | Crashed, instead of disabling auto-repeat.
* command: add commands for displaying overlayswm42013-10-052-0/+8
| | | | | | Requested by github issue #255. Does not work where mmap is not available (i.e. Windows).
* command: add sub_seek input commandwm42013-10-022-0/+2
| | | | | | | Essentially reuses the sub_step command, and is subject to the same restrictions. Seems to behave a bit strange sometimes, but generally works.
* input: remove strange offset from commands enumwm42013-10-021-1/+1
| | | | A leftover from 10 years of refactoring.
* input: handle MOUSE_LEAVE speciallywm42013-09-271-0/+8
| | | | | | Do this so that MOUSE_LEAVE can't be combined with other keys. (E.g. keep 'w' pressed, then move the mouse outside of the mpv window; it will print a warning what w-MOUSE_LEAVE is not mapped.)
* input: more mp_msg conversionwm42013-09-272-63/+56
| | | | | | | | It appears the last run missed all mp_tmsg(). Since the command parser also prints messages, it needs a new parameter to pass a log context. We go the easy way and just require the input_ctx to be passed, and use its mp_log.
* Add initial Lua scripting supportwm42013-09-262-0/+8
| | | | | | | | | | | | | | | | | | | | | | This is preliminary. There are still tons of issues, and any aspect of scripting may change in the future. I decided to merge this (preliminary) work now because it makes it easier to develop it, not because it's done. lua.rst is clear enough about it (plus some sarcasm). This requires linking to Lua. Lua has no official pkg-config file, but there are distribution specific .pc files, all with different names. Adding a non-pkg-config based configure test was considered, but we'd rather not. One major complication is that libquvi links against Lua too, and if the Lua version is different from mpv's, you will get a crash as soon as libquvi uses Lua. (libquvi by design always runs when a file is opened.) I would consider this the problem of distros and whoever builds mpv, but to make things easier for users, we add a terrible runtime test to the configure script, which probes whether libquvi will crash. This is disabled when cross-compiling, but in that case we hope the user knows what he is doing.
* input: fix accidental NULL pointer dereferencewm42013-09-111-2/+2
| | | | | | | This could happen if the input queue was full, and an unmapped key was used, or something like this. Possibly fixes github issue #224.
* input: convert to new msg APIStefano Pigozzi2013-09-102-26/+25
|
* input: rearrange codewm42013-09-081-44/+44
| | | | | | Let all key events go through mp_input_feed_key() internally, and also do double click and MP_INPUT_RELEASE_ALL handling there. Move check_autorepeat() to where it's actually used.
* input: don't deliver mouse events if mouse area is not setwm42013-09-082-4/+12
| | | | | | | | | | | | | | | | | | | | | This caused the OSC to be always visible at startup on X11: - EnterNotify event send a mouse event to input.c - OSC has not completely initialized yet, and no mouse area is set - mouse event is dispatched to "showhide" OSC section - OSC becomes visible, regardless of mouse position Fix this by treating the mouse area as empty if it's not set, instead of infinite as it was before this commit. This means an input section must set a mouse area to receive mouse events at all. We also have to change the default section to receive mouse events with the new behavior. Also, if MOUSE_MOVE is unmapped (or mapped to something that doesn't parse), and produces no command, the mouse position wouldn't be updated (because the mouse position is bound to input commands), so we have to generate a dummy command in this case. (This matters only for the OSC, On Screen Controller, which isn't merged yet, so these changes shouldn't have much effect right now.)
* input: merge consecutive mouse move eventswm42013-09-081-0/+14
| | | | Might give better behavior on load.
* input: split queue_add() functionwm42013-09-081-20/+20
| | | | | Split it into queue_add_head() and queue_add_tail(). Gets rid of the weird, rarely used boolean parameter.
* input: redo what input events can be droppedwm42013-09-081-57/+65
| | | | | | | | | | | | | | | | Until now, any command was dropped as soon as the input queue was full, and the command was not an abort command (i.e. a command that exits the player or goes to the next file). This could cause issues with key down events (especially mouse buttons) not being released. Change it so that key up events can never be dropped. This is a bit involved, because we know whether a key maps to an abort command only after interpreting it, and interpreting it changes global state, which in turn requires undoing the event if the input is dropped. Refactor the code a bit to move more functionality into interpret_key() to make this easier.
* input: remove separation between key and control queuewm42013-09-081-16/+10
| | | | | This is actually quite useless. It also allows the control queue to starve the key queue, because the control queue is always checked first.
* input: don't print warning if certain internal keys are not boundwm42013-09-061-2/+5
| | | | | | | | | | | This affects MOUSE_MOVE and MOUSE_LEAVE. Both are needed internally (such as for the OSC), but not really useful for input.conf. Since the warning has the purpose of notifying the user that a key is unmapped and what key name to use for setting up a binding in input.conf, the warning is rather useless in this case. It's also annoying in combination with the --no-input-default-bindings option, since that removes the default bindings to "ignore" for these keys.
* mpvcore/input: Fix build without pthreadsMartin Herkt2013-09-051-3/+5
|
* input: unlock playloop thread during selectStefano Pigozzi2013-09-011-0/+2
| | | | | | This allows other threads to use mp_input_put_key without blocking if the playloop is doing the 500ms select call (i.e.: during pause). Makes Cocoa GUI responsive again (regression since 2d363c3).
* osx: use MP_KEY_* instead of MK_* for media keysStefano Pigozzi2013-09-012-10/+0
| | | | | In 213ad5d6c I added `MK_*` key bindings overlooking the fact that mpv already has `MP_KEY_*` for media keys.
* input: allow window dragging even if mouse is in a mouse areawm42013-09-012-4/+13
| | | | | | If the input section is enabled with MP_INPUT_ALLOW_VO_DRAGGING, then the VO will be allowed to drag the window with mouse button down + mouse move even if the mouse is inside the section's mouse area.
* input: deal with spurious X11 LeaveNotify eventswm42013-09-011-6/+0
| | | | | | | | | | | | | | | | | | | | | If the mpv window is unfocus, clicking on the OSC should focus the window (done by the window manager) and allow interaction with the OSC. But somehow X sends a spurious LeaveNotify event, immediately followed by an EnterNotify event. This happens at least with IceWM. The result is that the OSC will disappear (due to receiving MOUSE_LEAVE). The OSC will stay invisible, because EnterNotify isn't handled, and there's nothing that could make the OSC appear again. Solve this by handling EnterNotify. We cause a redundant MOUSE_MOVE event to be sent, which triggers the code to make the OSC visible. We have to remove the code from input.c, which ignores redundant mouse move events. Since the code ignoring redundant mouse move events is still needed on Windows, move that code to w32_common.c. The need for this is documented in the code, also see commit 03fd2fe. (The original idea was to save some code by having this code in the core, but now it turns out that this didn't quite work out.)
* input: print more debug infos, raise loglevelwm42013-09-011-2/+20
|
* input: stay in current input section if mouse button is downwm42013-09-011-28/+63
| | | | | | | | | | | | | | | | | Normally, moving the mouse outside of the mouse area of an input section will send mouse events somewhere else (because input section mouse areas are similar to windows/widgets in real GUI toolkits). This was done even if a mouse button was held down. This is quite different from how GUI toolkits behave. Change the code so that if a mouse button is down, the mouse area of the current input section can't be left. Releasing the mouse button (while the mouse pointer is outside of the mouse area) will actually leave the mouse area. As a side-effect, this commit also tests more often whether the current mouse input section is valid. This is needed to make releasing a mouse button trigger the mouse input section change.
* input: add some more X11 multimedia/internet keyswm42013-09-012-1/+13
| | | | | | | | These keys can be found on various "multimedia" and "internet" keyboard. X defines many keycodes, so I'm not adding all, just what I found on my own keyboard. Other key codes can be added on request.
* keycodes: cosmetics: align indentationwm42013-09-011-113/+113
|
* input: comment all default bindings in input.confwm42013-09-011-1/+9
| | | | | | | | | | | | | | I suspect most users will just copy etc/input.conf when they want to remap some default bindings. But usually this means the user even copies bindings he doesn't care about, and it's better if the user maps only the bindings in his input.conf the user intends to remap. Comment all bindings in etc/input.conf. Since this file also defines the builtin defaults and is baked into the mpv binary, we have to do something to get them anyway, even though they are commented. Do this by having input.c "uncomment" the bindings in the baked in input.conf. (Of course this is done only for the builtin config, not configs loaded from disk.)
* input: lock for accessing struct input_ctxStefano Pigozzi2013-09-011-67/+114
| | | | | | | | | | | | | | The previous code was locking only the input queue. That was too weak since it didn't protect the input_ctx data structure. So remove the locking on the queue and lock all the public functions that interact with the input_ctx. The private functions and public functions that do not act on the input_ctx (there are quite some functions doing mp_cmd manipulations for instance) are not locked. Some changes by wm4. Use a recursive mutex, and restructure some code to be less annoying with locks, such as converting code to single return, or making use of the recursive mutex.
* input: fix --no-input-default-bindingswm42013-08-291-0/+2
| | | | The option did nothing. This was probably broken with 5b38a52.
* input: fix build if HAVE_PTHREADS is undefinedGiuliano Schneider2013-08-151-1/+1
|
* macosx: remove platform specific input queueStefano Pigozzi2013-08-131-3/+0
| | | | | Since last commit the input queue in the core is thread safe, so there is no need for all this platform specific stuff anymore.
* input: make input queue thread safeStefano Pigozzi2013-08-131-6/+35
| | | | | | | If pthreads are enabled the input queue accesses are regulated by acquiring a mutex. This is useful for platforms like OS X, where the events are created in the cocoa thread and added to the queue to then be dequeued in the playloop thread.
* input: add support for precise scroll axesAlexander Preisinger2013-08-073-0/+30
| | | | | | | | | | | | | | | Support horizontal and vertical axes of input devices. If the input device support precise scrolling with an input value then it should first be scaled to a standard multiplier, where 1.0 is the default. The multiplier will then applied to the following commands if possible: * MP_CMD_SEEK * MP_CMD_SPEED_MULT * MP_CMD_ADD All other commands will triggered on every axis event, without change the values specified in the config file.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-064-12/+12
| | | | Followup commit. Fixes all the files references.
* core: move contents to mpvcore (1/2)Stefano Pigozzi2013-08-067-0/+3145
core is used in many unix systems for core dumps. For that reason some tools work under the assumption that the file is indeed a core dump (for example autoconf does this). This commit just renames the files. The following one will change all the includes to fix compilation. This is done this way because git has a easier time tracing file changes if there is a pure rename commit.