~exec64/imv#7: 
Keypresses may get repeated

I'm having the same problem as issues #201 and #272 on Github, even on the newest version (4.3.1). I have a binding

[binds]
<Shift+X> = exec garbage put "$imv_current_file"; close

that can get executed multiple times when working with large images, and skipping can also occur when using the arrow keys.

For extra info, this is under wayland using wlroots 0.15.1.

Status
REPORTED
Submitter
~firegem
Assigned to
No-one
Submitted
3 years ago
Updated
7 months ago
Labels
No labels applied.

Денис 2 years ago · edit

I confirm that. When i open imv via thunar and press Shift+E for exec gimp "$imv_current_file", it open gimp too many times. if open imv in terminal it work fine

Денис 2 years ago · edit

Check it again, from terminal but repeated.

Finn Steffens 2 years ago · edit

On Wayland key presses can repeat indefinitely if the user unfocused the imv window before releasing the key. This issue has to do with the missing handling of the keyboard_enter and keyboard_leave events. At the very least the keyboard_leave event has to clear the running keyboard repeat timer. e.g.:

diff --git a/src/wl_window.c b/src/wl_window.c index 5efa42f..a44a6ca 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -129,10 +129,22 @@ static void keyboard_enter(void *data, struct wl_keyboard *keyboard, static void keyboard_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface) {

  • (void)data; (void)keyboard; (void)serial; (void)surface;
  • struct imv_window *window = data;
  • struct itimerspec off = {
  • .it_value = {
  •  .tv_sec = 0,
    
  •  .tv_nsec = 0,
    
  • },
  • .it_interval = {
  •  .tv_sec = 0,
    
  •  .tv_nsec = 0,
    
  • },
  • };
  • timer_settime(window->timer_id, 0, &off, NULL); }

static void cleanup_event(struct imv_event *event)

I haven't figured out though why key presses can repeat when the currently opened image changes.

blankie 2 years ago · edit

Finally managed to figure out how to consistently reproduce this bug (without unfocusing imv, which seems to be a different bug). It happens when a keybinding that executes a shell command takes a second or so to execute. For example: the keybinding "t = exec sleep 1 && echo T pressed" would keep printing "T pressed" even after releasing T.

blankie referenced this from #6 1 year, 2 months ago

~rlb 7 months ago

I think I probably just hit this when testing a [bind]. i.e. binding a keypress to exec saytime sends imv into an infinite loop where q wont quit, and any C-c or C-\ just interrupts the current saytime, and it starts over. Eventually had to kill imv from another terminal.

~trinitronx 7 months ago*

Another reproduction case:

Note: My sway user config has: include $HOME/.config/sway/config.d/*.conf

~/.config/sway/config.d/01-keyboard-delay-repeat-rate.conf:

## Replace input identifier with one matching your keyboard
input "1133:16475:Logitech_K780" {
    repeat_delay 300
    repeat_rate 50
}

Then, configure dragon-drop (aur/dragon-drop) as a keybinding:

~/.config/imv/config:

[binds]
<Shift+D> = exec dragon-drop -s 400 --and-exit "$imv_current_file"

Same results: Infinite loop after pressing q to quit dragon-drop... imv keeps spawning a new instance of dragon-drop process.

Workaround that I found was to background the process with &, as suggested in the last comment on the old GitHub issue: eXeC64/imv#207

~/.config/imv/config:

[binds]
<Shift+D> = exec dragon-drop -s 400 --and-exit "$imv_current_file" &
Register here or Log in to comment, or comment via email.