Browse code

ffplay: toggle full screen when double-clicking the video window with the left mouse button

Now that the seek only happens with the right mouse button, it makes
sense to toggle full screen when double-clicking with the left mouse
button, like other video players do.

Signed-off-by: Vittorio Gambaletta <ffmpeg-dev@vittgam.net>
Signed-off-by: Marton Balint <cus@passwd.hu>

Vittorio Gambaletta (VittGam) authored on 2016/01/19 08:57:38
Showing 2 changed files
... ...
@@ -55,6 +55,7 @@ version <next>:
55 55
 - spectrumsynth filter
56 56
 - ahistogram filter
57 57
 - only seek with the right mouse button in ffplay
58
+- toggle full screen when double-clicking with the left mouse button in ffplay
58 59
 
59 60
 
60 61
 version 2.8:
... ...
@@ -3473,6 +3473,16 @@ static void event_loop(VideoState *cur_stream)
3473 3473
                 do_exit(cur_stream);
3474 3474
                 break;
3475 3475
             }
3476
+            if (event.button.button == SDL_BUTTON_LEFT) {
3477
+                static int64_t last_mouse_left_click = 0;
3478
+                if (av_gettime_relative() - last_mouse_left_click <= 500000) {
3479
+                    toggle_full_screen(cur_stream);
3480
+                    cur_stream->force_refresh = 1;
3481
+                    last_mouse_left_click = 0;
3482
+                } else {
3483
+                    last_mouse_left_click = av_gettime_relative();
3484
+                }
3485
+            }
3476 3486
         case SDL_MOUSEMOTION:
3477 3487
             if (cursor_hidden) {
3478 3488
                 SDL_ShowCursor(1);