Skip to content
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

input: implement VO dragging deadzone #14251

Merged
merged 7 commits into from
Jun 4, 2024

Conversation

na-na-hi
Copy link
Contributor

@na-na-hi na-na-hi commented May 28, 2024

This PR fixes several problems with VO dragging:

  • Adds --input-dragging-deadzone option, which adds a deadzone for the built-in VO dragging.
  • Dragging now only begins after the mouse is moved outside of the deadzone while the left button is held down, which should resolve race condition with dragging on some WMs.
  • Resolves the conflict between VO dragging and MBTN_LEFT binding.
  • Makes it possible to disable the built-in VO dragging so that custom dragging behavior can be implemented.
  • Prevents activation of double click if the first click begins VO dragging.

Fixes #7563.
Fixes #13225.
Fixes #13958.
Fixes #14248.

The stored mouse position mouse_vo_x/y are scaled (currently only for
vo_xv), but the position equality check compares between raw position
and scaled position.

Fix this by storing and checking the raw position instead. The raw
position is useful for the next commit.
Copy link

github-actions bot commented May 28, 2024

Download the artifacts for this pull request:

Windows
macOS

This adds the --input-dragging-deadzone option, which adds a deadzone
for the built-in VO deagging. This prevents accidental VO dragging.
Currently, the built-in VO dragging conflicts with the MBTN_LEFT binding,
so the binding is activated even though the VO dragging begins. Fix this
by releasing the currently down command so that MBTN_LEFT can be bound to
a useful action (such as play/pause).
This adds the --input-builtin-dragging option, which allows the built-in
dragging behavior to be disabled. This allows scripts to implement custom
dragging behavior with left button down events and begin-vo-dragging
command, which could only be done for other mouse buttons before.
This prevents doubleclick from activation if a second mouse click comes
quickly after a click which begins dragging.
@verygoodlee
Copy link
Contributor

verygoodlee commented Jun 5, 2024

It breaks OSC seekbar mouse dragging, both osc.lua uosc and mpv-osc-modern are affected.

@na-na-hi
Copy link
Contributor Author

na-na-hi commented Jun 5, 2024

It breaks OSC seekbar mouse dragging

Should be fixed by #14301.

@verygoodlee
Copy link
Contributor

verygoodlee commented Jun 6, 2024

Why conflict with MBTN_LEFT script binding.
In this case, #7563 can still reproducible, the difference is MBTN_LEFT is triggered at the begin of dragging, not at the end of dragging.

mp.add_forced_key_binding('MBTN_LEFT', 'MBTN_LEFT', function() mp.commandv('cycle', 'pause') end)

@na-na-hi
Copy link
Contributor Author

na-na-hi commented Jun 6, 2024

In this case, #7563 can still reproducible, the difference is MBTN_LEFT is triggered at the begin of dragging, not at the end of dragging.

There is a bug with key bindings registered by scripts which are incorrectly triggered if the command is canceled. #14311 fixes this.

input.conf bindings aren't affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants