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

Unable to pan zoomed images #29

Open
m41t opened this issue Apr 7, 2023 · 6 comments
Open

Unable to pan zoomed images #29

m41t opened this issue Apr 7, 2023 · 6 comments

Comments

@m41t
Copy link

m41t commented Apr 7, 2023

I am trying mvi on a QubesOS qube, running debian 11. mvi can open images, but once I zoom in, I cannot pan (move) the image. Ctrl + (arrow keys) are doing nothing. Alt + (arrow keys) are doing nothing. Mpv does NOT report "No key binding found for key 'Ctrl+right'" but still I cannot pan over the zoomed in image.

Here are the terminal outputs when I open a folder full of image files:

[user@dotfiles]:~/QubesIncoming/mmedia % mvi chiaroscuro
[file] This is a directory - adding to playlist.

Auto-loading profile 'extension.jpeg'
Playing: chiaroscuro/accelerate.jpeg
 (+) Video --vid=1 (mjpeg 1.000fps)
libEGL warning: DRI2: failed to authenticate
[vo/gpu/opengl] Suspected software renderer or indirect context.
[vo/gpu/opengl] Suspected software renderer or indirect context.
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[vo/vdpau] Error when calling vdp_device_create_x11: 1
[vo/xv] No Xvideo support found.
[vo/sdl] Using opengl
[vo/sdl] Warning: this legacy VO has bad performance. Consider fixing your graphics drivers, or not forcing the sdl VO.
VO: [sdl] 960x1280 yuv420p
[detect_image] First image detected
[detect_image] Image detected

Here's my mvi config directory:

[user@dotfiles]:~/.config/mvi % (U! master) tree
.
├── input.conf
├── mpv.conf
├── script-opts
│   ├── detect_image.conf
│   ├── image_positioning.conf
│   ├── minimap.conf
│   ├── ruler.conf
│   └── status_line.conf
├── scripts
│   ├── detect-image.lua
│   ├── equalizer.lua
│   ├── freeze-window.lua
│   ├── image-positioning.lua
│   ├── minimap.lua
│   ├── ruler.lua
│   └── status-line.lua
└── watch_later

3 directories, 14 files

And here's the mvi alias:

[user@dotfiles]:~/.config/mvi % (U! master) alias mvi
mvi='mpv --config-dir=$HOME/.config/mvi'

Why am I unable to pan the zoomed images? Is this due to some limitation of QubesOS virtualization?

@occivink
Copy link
Owner

occivink commented Apr 8, 2023

I doubt it's related to the virtualization. You can check whether mpv properly receives the shortcuts in the first place by doing mpv --no-config --input-test --idle --force-window, and then check if it reports Ctrl+left/right/up/down. If it does, then it's probably the case that your input.conf does not contain the proper bindings.

@m41t
Copy link
Author

m41t commented Apr 8, 2023

Here's what I get:

[input] Key MOUSE_MOVE is bound to:
[input] 1.  'script-binding osc/__keybinding1' in section {showhide} in <api>:1
[input] 2.  'script-binding osc/__keybinding3' in section {showhide_wc} in <api>:1
[input] Key Alt+RIGHT is bound to:
[input] 1.  'add video-pan-x -0.1' in <builtin>:1 (default)
[input] Key Alt+LEFT is bound to:
[input] 1.  'add video-pan-x  0.1' in <builtin>:1 (default)
[input] Key Alt+DOWN is bound to:
[input] 1.  'add video-pan-y -0.1' in <builtin>:1 (default)
[input] Key Alt+UP is bound to:
[input] 1.  'add video-pan-y  0.1' in <builtin>:1 (default)
[input] Key Ctrl+LEFT is bound to:
[input] 1.  'no-osd sub-seek -1' in <builtin>:1 (default)
[input] Key Ctrl+RIGHT is bound to:
[input] 1.  'no-osd sub-seek  1' in <builtin>:1 (default)
[input] Key Ctrl+UP is bound to:
[input] (nothing)
[input] Key Ctrl+DOWN is bound to:
[input] (nothing)

Ctrl/Alt + arrow-keys doesn't seem to be reporting to the mvi scripts, am I wrong?

If it does, then it's probably the case that your input.conf does not contain the proper bindings.

Am I supposed to edit the input.conf file and add the bindings? I assumed it would contain default bindings.

@occivink
Copy link
Owner

occivink commented Apr 9, 2023

Am I supposed to edit the input.conf file and add the bindings? I assumed it would contain default bindings.

That's correct, it's mentioned here

@m41t
Copy link
Author

m41t commented Apr 9, 2023

The following lines came with the input.conf file:

ctrl+down  repeatable script-message pan-image y -0.1 yes yes
ctrl+up    repeatable script-message pan-image y +0.1 yes yes
ctrl+right repeatable script-message pan-image x -0.1 yes yes
ctrl+left  repeatable script-message pan-image x +0.1 yes yes

# now with more precision
alt+down   repeatable script-message pan-image y -0.01 yes yes
alt+up     repeatable script-message pan-image y +0.01 yes yes
alt+right  repeatable script-message pan-image x -0.01 yes yes
alt+left   repeatable script-message pan-image x +0.01 yes yes

Aren't they setting the alt/ctrl + cursor keys for panning the image already? If not, how should I change those? This is my first time setting up keybinds for mpv on input.conf, so I would appreciate an example.

@occivink
Copy link
Owner

occivink commented Apr 9, 2023

and does the input.conf file in your config directory contain these lines? this is what matters. Please upload the .config/mvi/input.conf file

@m41t
Copy link
Author

m41t commented Apr 9, 2023

Here's my ~/.config/mvi/input.conf file:

1 change-list script-opts append image_positioning-drag_to_pan_margin=200
2 change-list script-opts append ruler-exit_bindings=8
3 change-list script-opts append ruler-line_color=FF
4 change-list script-opts append ruler-scale=25
5 change-list script-opts append ruler-max_size=20,20

SPACE repeatable playlist-next
alt+SPACE repeatable playlist-prev

UP ignore
DOWN ignore
LEFT repeatable playlist-prev
RIGHT repeatable playlist-next

# simple reminder of default bindings
#1 add contrast -1
#2 add contrast 1
#3 add brightness -1
#4 add brightness 1
#5 add gamma -1
#6 add gamma 1
#7 add saturation -1
#8 add saturation 1

# mouse-centric bindings
MBTN_RIGHT script-binding drag-to-pan
MBTN_LEFT  script-binding pan-follows-cursor
MBTN_LEFT_DBL ignore
WHEEL_UP   script-message cursor-centric-zoom 0.1
WHEEL_DOWN script-message cursor-centric-zoom -0.1

# panning with the keyboard:
# pan-image takes the following arguments
# pan-image AXIS AMOUNT ZOOM_INVARIANT IMAGE_CONSTRAINED
#            ^            ^                  ^
#          x or y         |                  |
#                         |                  |
#   if yes, will pan by the same         if yes, stops panning if the image
#     amount regardless of zoom             would go outside of the window

ctrl+down  repeatable script-message pan-image y -0.1 yes yes
ctrl+up    repeatable script-message pan-image y +0.1 yes yes
ctrl+right repeatable script-message pan-image x -0.1 yes yes
ctrl+left  repeatable script-message pan-image x +0.1 yes yes

# now with more precision
alt+down   repeatable script-message pan-image y -0.01 yes yes
alt+up     repeatable script-message pan-image y +0.01 yes yes
alt+right  repeatable script-message pan-image x -0.01 yes yes
alt+left   repeatable script-message pan-image x +0.01 yes yes

# replace at will with h,j,k,l if you prefer vim-style bindings

# on a trackpad you may want to use these
#WHEEL_UP    repeatable script-message pan-image y -0.02 yes yes
#WHEEL_DOWN  repeatable script-message pan-image y +0.02 yes yes
#WHEEL_LEFT  repeatable script-message pan-image x -0.02 yes yes
#WHEEL_RIGHT repeatable script-message pan-image x +0.02 yes yes

# align the border of the image to the border of the window
# align-border takes the following arguments:
# align-border ALIGN_X ALIGN_Y
# any value for ALIGN_* is accepted, -1 and 1 map to the border of the window
ctrl+shift+right script-message align-border -1 ""
ctrl+shift+left  script-message align-border 1 ""
ctrl+shift+down  script-message align-border "" -1
ctrl+shift+up    script-message align-border "" 1

# reset the image
ctrl+0  no-osd set video-pan-x 0; no-osd set video-pan-y 0; no-osd set video-zoom 0

+ add video-zoom 0.5
- add video-zoom -0.5; script-message reset-pan-if-visible
= no-osd set video-zoom 0; script-message reset-pan-if-visible

e script-message equalizer-toggle
alt+e script-message equalizer-reset

h no-osd vf toggle hflip; show-text "Horizontal flip"
v no-osd vf toggle vflip; show-text "Vertical flip"

r script-message rotate-video 90; show-text "Clockwise rotation"
R script-message rotate-video -90; show-text "Counter-clockwise rotation"
alt+r no-osd set video-rotate 0; show-text "Reset rotation"

d script-message ruler

# Toggling between pixel-exact reproduction and interpolation
a cycle-values scale nearest ewa_lanczossharp

# Toggle color management on or off
c cycle icc-profile-auto

# Screenshot of the window output
S screenshot window

# Toggle aspect ratio information on and off
A cycle-values video-aspect-override "-1" "no"

p script-message force-print-filename

# ADVANCED: you can define bindings that belong to a "section" (named "image-viewer" here) like so:
#alt+SPACE {image-viewer} repeatable playlist-prev
#SPACE     {image-viewer} repeatable playlist-next
# to load them conditionally with a command. See scripts-opts/image_viewer.conf for how you can do this

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

No branches or pull requests

2 participants