-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
command: make script-binding command scalable #15316
base: master
Are you sure you want to change the base?
Conversation
Download the artifacts for this pull request: |
Did you mean If it's still script-message, then at which level is the extra argument added? The So adding an argument at this level will surely break existing clients which expect the receiver to see exactly the arguments they send. Or maybe it's only in how script-binding uses script-message? Please clarify. |
It's noted in the changed I have updated the commit message to clarify this.
This only affects how |
script-binding command is currently not scalable, so script registered key bindings also cannot be scalable, unlink input.conf bindings. This makes script-binding command scalable so that it's possible to define scalable key bindings in scripts. It now calls script-message command with an extra argument with the scale of the key.
For complex key bindings, the table now contains a new member of the current key scale. mp.add_key_binding() now accepts the scalable flag to make the binding scalable.
bbc36ac
to
49284a7
Compare
This documents the commands which are scalable, and refer to information on how it affects input processing.
7ab0ca9
to
43ab609
Compare
Added some documentation for scalable keys and scalable commands to better clarify scalable stuffs as a whole. |
db326b1
to
4ed42c6
Compare
This documents the scalable keys (currently WHEEL_*) and notes how the keys work with scalable commands. Mention touch pad as a common source of scalable input source.
4ed42c6
to
e1d605a
Compare
We can't actually use this for cursor-centric-zoom can we? Because that needs to be bound to script-message in input.conf and not script-binding to send the zoom argument. |
You can add a script key binding for |
I mean the user can no longer configure the zoom amount in input.conf. I guess we need to add a script-opt for it, which is more indirect. |
Actually,
On top of |
The case you mentioned can simply be a |
In my opinion having both script-message and script-binding for the same function is more complex to write and document than to just write it in C and extremely confusing for users, how are they supposed to understand which one to use? And users that want both high resolution scaling and bindings with different amounts still have to define user-unfriendly bindings like above. |
The intended way is to configure keybinds and amounts as script options, and let the script create and destroy key bindings by itself, and doesn't require putting anything into The only reason they are useful as script messages is for other scripts to call them. I don't think they're needed on their own when script options serve the purpose.
Like I said script options is a better choice.
I mentioned in your PR how features like animated zooming would be much harder to do in C while being easier in lua. mpv clients are clearly in a better place to implement these features compared in player core.
Yeah, some are commands and others are script messages... totally not confusing which you seem trying so hard to avoid. I looked into making the |
I don't think zoom and pan amounts are complex or specialized. All key bindings that modify properties already configure amounts in input.conf, it is nothing new.
We can add a command for osd-relative-pan and keep cursor-centric-zoom in a script a middle ground. Wanting key bindings that pan with different amounts should be much more common than key bindings that zoom in different amounts. This is also the case in https://github.com/occivink/mpv-image-viewer/blob/master/input.conf, it has multiple pan amounts and one cursor-centric-zoom amount. I don't know if having to define the bindings in #15316 (comment) just do that seems sane to you. ¯\(ツ)/¯ But if maintainers deem it fine I'm fine with either way.
Most mpv key bindings are already commands and some script messages, the only difference is that I'm adding these ones at the same time.
Nah, that is too hacky. You can't know whether numbers for script-message are floats or integers not meant to be scaled. Also ideally the axis would ideally be the first argument to pan. |
This makes
script-binding
command and key bindings added bymp.add_key_binding()
scalable. The script-message command now has an extra argument with the scale of the key.