PR #22907 opened by Hamster
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22907
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22907.patch

there is currently no need to allow right click seeking if a keyboard key is 
currently being pressed down, some window managers allow windows to be resized 
if you press a keyboard button and right click, this prevents ffplay seeking a 
video when resizing windows in window managers


>From 06be1cb7d866e39107ce04480e1c90ac7f6425bb Mon Sep 17 00:00:00 2001
From: Hamster <[email protected]>
Date: Fri, 24 Apr 2026 09:28:32 +0000
Subject: [PATCH] Prevent timeline seeking on right click if a button is
 pressed down

there is currently no need to allow right click seeking if a keyboard key is 
currently being pressed down, some window managers allow windows to be resized 
if you press a keyboard button and right click, this prevents ffplay seeking a 
video when resizing windows in window managers
---
 fftools/ffplay.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 28a83e079f..9b80618554 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3448,12 +3448,17 @@ static void event_loop(VideoState *cur_stream)
 {
     SDL_Event event;
     double incr, pos, frac;
+    static int iskeydown = 0;
 
     for (;;) {
         double x;
         refresh_loop_wait_event(cur_stream, &event);
         switch (event.type) {
+        case SDL_KEYUP:
+            iskeydown = 0;
+            break;
         case SDL_KEYDOWN:
+            iskeydown = 1;
             if (exit_on_keydown || event.key.keysym.sym == SDLK_ESCAPE || 
event.key.keysym.sym == SDLK_q) {
                 do_exit(cur_stream);
                 break;
@@ -3591,6 +3596,7 @@ static void event_loop(VideoState *cur_stream)
                     break;
                 x = event.motion.x;
             }
+            if(iskeydown == 1){break;}
                 if (seek_by_bytes || cur_stream->ic->duration <= 0) {
                     uint64_t size =  avio_size(cur_stream->ic->pb);
                     stream_seek(cur_stream, size*x/cur_stream->width, 0, 1);
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to