[FFmpeg-devel] [PATCH v2 2/2] ffplay: Toggle full screen when double-clicking the video window with the left mouse button.
Vittorio Gambaletta (VittGam)
ffmpeg-dev at vittgam.net
Sat Jan 16 22:41:31 CET 2016
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 at vittgam.net>
---
ffplay.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/ffplay.c b/ffplay.c
index 2fa7165..5b473e9 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -3473,6 +3473,16 @@ static void event_loop(VideoState *cur_stream)
do_exit(cur_stream);
break;
}
+ if (event.button.button == SDL_BUTTON_LEFT) {
+ static int64_t last_mouse_left_click = 0;
+ if (av_gettime_relative() - last_mouse_left_click <= 500000) {
+ toggle_full_screen(cur_stream);
+ cur_stream->force_refresh = 1;
+ last_mouse_left_click = 0;
+ } else {
+ last_mouse_left_click = av_gettime_relative();
+ }
+ }
case SDL_MOUSEMOTION:
if (cursor_hidden) {
SDL_ShowCursor(1);
More information about the ffmpeg-devel
mailing list