jonniek / mpv-playlistmanager

Mpv lua script to create and manage playlists
The Unlicense
537 stars 42 forks source link

key_moveup and key_movedown mapped to WHEEL_UP and WHEEL_DOWN jump two items in osd #133

Closed Lovecraft-github closed 9 months ago

Lovecraft-github commented 9 months ago

I have key_showplaylist=SHIFT+ENTER MBTN_MID key_moveup=UP WHEEL_UP key_movedown=DOWN WHEEL_DOWN key_playfile=ENTER MBTN_LEFT key_closeplaylist=ESC SHIFT+ENTER MBTN_MID

to use the script with the mouse

Show and close the OSD and play the file selected with left click work fine but the mouse wheel jumps two items up and down instead of one.

mpv v0.37.0-7-g86b498ecc0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects built on Nov 22 2023 17:27:28 libplacebo version: v6.338.0-58-g2385b367 FFmpeg version: N-112826-g707e46dc54 FFmpeg library versions: libavutil 58.32.100 libavcodec 60.34.100 libavformat 60.17.100 libswscale 7.6.100 libavfilter 9.13.100 libswresample 4.13.100

Ubuntu 23.10 with gnome 45.0

jonniek commented 9 months ago

I'm not able to reproduce this. If you do key_movedown=WHEEL_DOWN does it work correctly?

Could this be an issue with your mouse? Could you run mpv --input-test --force-window --idle and observe that when you scroll down only 1 input event is happening?

Lovecraft-github commented 9 months ago

I'm not able to reproduce this. If you do key_movedown=WHEEL_DOWN does it work correctly?

Not, continue to jump from 1 to 3 to 5 etc Could this be an issue with your mouse? Could you run mpv --input-test --force-window --idle and observe that when you scroll down only 1 input event is happening?

Seems to be 2 events

        input: Key WHEEL_DOWN is bound to:
        input: 1.  'add volume -2' in <builtin>:1 (default)
        input: 2.  'seek -10' in /home/user/.config/mpv/input.conf:43
        input: 3.  'script-binding osc/__keybinding10' in section {input} in <api>:6
        input: Key WHEEL_DOWN is bound to:
        input: 1.  'add volume -2' in <builtin>:1 (default)
        input: 2.  'seek -10' in /home/user/.config/mpv/input.conf:43
        input: 3.  'script-binding osc/__keybinding10' in section {input} in <api>:6

I tried 3 different mouses and happens with all of them

with xev it only show one event (press and release)

ButtonPress event, serial 38, synthetic NO, window 0xa00001, root 0x3d1, subw 0x0, time 150021329, (157,1), root:(307,188), state 0x10, button 5, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0xa00001, root 0x3d1, subw 0x0, time 150021329, (157,1), root:(307,188), state 0x1010, button 5, same_screen YES

ButtonPress event, serial 38, synthetic NO, window 0xa00001, root 0x3d1, subw 0x0, time 150023001, (157,1), root:(307,188), state 0x10, button 4, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0xa00001, root 0x3d1, subw 0x0, time 150023001, (157,1), root:(307,188), state 0x810, button 4, same_screen YES

jonniek commented 9 months ago

Interesting. It seems from my scripts point of view it is behaving correctly if we are in fact receiving 2 wheel down events from mpv. Could you just double check that this issue also applies to native mpv functionality like pause (instant pause and unpause on one scroll down).

I would recommend maybe opening an issue in mpv repository if you think it's an issue in mpv rather than your operating system or hardware.

Lovecraft-github commented 9 months ago

Interesting. It seems from my scripts point of view it is behaving correctly if we are in fact receiving 2 wheel down events from mpv. Could you just double check that this issue also applies to native mpv functionality like pause (instant pause and unpause on one scroll down).

with WHEEL_DOWN cycle pause in input.conf

        input: Key WHEEL_DOWN is bound to:
        input: 1.  'add volume -2' in <builtin>:1 (default)
        input: 2.  'cycle pause' in /home/user/.config/mpv/input.conf:44
        input: 3.  'script-binding osc/__keybinding10' in section {input} in <api>:6
        input: Key WHEEL_DOWN is bound to:
        input: 1.  'add volume -2' in <builtin>:1 (default)
        input: 2.  'cycle pause' in /home/user/.config/mpv/input.conf:44
        input: 3.  'script-binding osc/__keybinding10' in section {input} in <api>:6

Same

I would recommend maybe opening an issue in mpv repository if you think it's an issue in mpv rather than your operating system or hardware.

I think I found the problem.

Is the wayland session. In a Xorg session using imwheel to change the scroll lines of the wheel button it obeys the value 1 lines, 2 lines, etc. Works fine without any imwheel modification too

But in the wayland session imwheel doesn't work and I don't know how to change the value and it seems to be 2 lines for event.

Do you think that is worth to post the problem in mpv?

jonniek commented 9 months ago

Nice debugging!

Do you think that is worth to post the problem in mpv?

Probably worth it. On a quick look it seems there is some wayland specific code in mpv. Not sure if that has anything to do with inputs though. If it consistently happens with all applications, then probably the issue is in wayland and could be reported elsewhere.

I'll close this issue as resolved!