This unifies --drag-and-drop handling to a single place. All platforms
currently only support normal drop (mapped to "replace") and shift click
drop (mapped to "append").
This adds dropped-file property which contains a list of dropped files
and the type of the drop. This allows clients to implement custom drag
and drop handling.
Some commands have named arguments named "name", which conflict with
the "name" entry used to specify command name in mpv_command_node, so
they cannot be used with mpv_command_node.
These commands include:
set, del, change-list, add, cycle, multiply, enable-section,
disable-section, define-section, script-binding, keybind, keypress,
keydown, keyup, apply-profile.
This makes mpv_command_node accept command name as key "_name", so
"name" can be used to specify command arguments. For compatibility,
if "_name" entry does not exist, then "name" is used as fallback.
If --input-ipc-server path name starts with "@", then "@" is replaced
with a null character, which represents the abstract socket namespace
on Linux. Because abstract sockets have no file system presence, it
should not delete the file with the same name starting with "@".
mp_input_get_tablet_pos stores the address to an array that is protected
by lock, and the content is accessed without acquiring lock.
Fix this by writing the values to an array inside mp_input_get_tablet_pos.
Fixes: 0fbf20f057
When buttons > MP_MAX_TABLET_PAD_BUTTONS and the value is stored in
ictx->tablet_pad_buttons, the next mp_input_set_tablet_pad_focus call
will cause out of bound write, and mp_property_tablet_pos will cause
out of bound read.
Fix this by limiting ictx->tablet_pad_buttons range.
Fixes: 0fbf20f057
The current handling tries to handle the edge case where the current key
in a combo key is -, but when the current key is not - and the next key
is -, it misdetects - as separator and fails to parse correctly.
Fix this by restricting the handling to situations where the current key
is -.
Fixes: ce2367725e
Like the previous commit, this has a conditional that matches exactly
what this helper function is supposed to do. For logging reasons, we
can't completely remove the val->format comparison, but it can be
simplified to be cleaner.
Upgrade tablet input to first class citizen similar like
touch input, but more simple since use case for now is
mouse emulation only.
Keep state for coordinates and in-proximity.
Introduce property for disabling tablet input.
Introduce Client-API property `tablet-pos`.
Clients run in detached threads and are waited to signal when they are
finished with self mpv_destroy() call. Problem is that after detached
thread calls this function, mpv consider this client to be done and can
do whatever. One example is when mpv exits and wait for scripts to
finish we got race condition, because mpv (main thread) can exit first
and the detached thread calls ta_free() which crashes, because we may
have already destroyed things that the thread depends on.
I've seen this crash on FreeBSD CI job (libmpv-lifetime test), where the
libmpv.so has been unloaded while the thread was still doing ta_free()
```
==5081==ERROR: AddressSanitizer: SEGV on unknoun address 0x000001111806 (pc 0x000001111806 bp 0x7fffdedf4e40 sp 0x7fffdedf4e08 T40)
==5081==The signal is caused by a READ memory access.
#0 0x1111806 (<unknown module>)
#1 0x803cd6900 in ta_free /home/runner/work/mpv/mpv/build/../ta/ta.c:243:5
#2 0x803a2fc87 in run_script /home/runner/work/mpv/mpv/build/../player/scripting.c:93:5
#3 0x803a2ffe0 in script_thread /home/runner/work/mpv/mpv/build/../player/scripting.c:99:5
#4 0x2c451a in asan_thread_start(void*) /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28
#5 0x80034fb04 (/lib/libthr.so.3+0x10b04)
```
Note the 0x1111806 jump which is completelly bogus.
Fix this by doing mpv_destroy() as a last step in detached threads.
This relaxes what bbac628a1b introduced.
Although it is rare, there may be scripts out there that depend on the
old timing. We'd still like to process config files in a sane manner and
not cause OOMs so keep the general coalescing mechanism in place but use
it selectively. There is one special case with the --input-commands
option. We want this coalesced as well so some special handling needs to
be added for that.
Setting the mouse position always updates the cursor visibility state in
the core, but that's not always desired by the caller. Make it optional.
In practice, this is for wayland. Fixes#15967.
--input-cmdlist crops playlist-next-playlist, playlist-prev-playlist,
write-watch-later-config and delete-watch-later-config, so increase the
string length to that of the longest command.
Also stop specifying both the minimum and maximum length since they are
the same.
The command is documented to use the same syntax as input.conf, but
it doesn't work with sequence keys because it uses
mp_input_get_key_from_name for checking key names, when it should
use mp_input_get_keys_from_string instead.
Fix this by using the correct function.
Some keys like WHEEL_UP are "scaled" if the input source is high
resolution, like touchpad. However, sometimes it's desirable to
disable this scaling and only active the key binding in discrete
steps, such as relative keyframe seeking which interacts poorly
if the command is scaled.
This adds the nonscalable prefix to disable this scaling.
Key names are already required be UTF-8 like everything else
in mpv other than media file formats which support other encodings.
stream_skip_bom is the wrong function for this, since it also skips
UTF-16 BOM.
It has been changed in one of the iterations of the patch during review,
but bstr doesn't have to be null terminated. Fix it by adding dedicated
node_map helper.
Fixes: 1a27f3c
In general, mpv treats numpad keys as separate inputs. The +-*/ keys
however are exceptions so it's not possible to distinguish them from
non-numpad keys.
This adds keycodes corresponding to these keys so that they can be
handled differently.
I don't know if this broke anything but the the condition was inverted
as a result of the recent commit.
Fixes: 1a27f3caf7 ("input: use bstr for section name")
Resolves mixed use of bstr in internal processing and char* for storage.
Also makes faster comparision when searching for section and resolves
comparision when name contains null chars.
This makes --input-ipc-client work on Windows.
To use this feature, a parent process needs to create a connected named pipe,
wrap the server handle in a CRT fd, and then spawn mpv as a child process
with the fd as the --input-ipc-client parameter.
The process can then communicate through the client handle.
The named pipe must be created duplex with overlapped IO and inheritable
handles.