]> git.nihav.org Git - nihav-player.git/commitdiff
use mouse wheel to seek by ten seconds
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 2 Jul 2023 14:29:12 +0000 (16:29 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 2 Jul 2023 14:29:12 +0000 (16:29 +0200)
videoplayer/src/main.rs

index a60c15d363a3179f167795d6ffc0866ce3be49cb..d60f4395b1217f59a7c08053a86c51b2535d592c 100644 (file)
@@ -13,7 +13,7 @@ use std::sync::atomic::{AtomicU8, Ordering};
 
 use sdl2::event::{Event, WindowEvent};
 use sdl2::keyboard::{Keycode, Mod};
-use sdl2::mouse::MouseButton;
+use sdl2::mouse::{MouseButton, MouseWheelDirection};
 use sdl2::render::{Canvas, Texture, TextureCreator};
 use sdl2::pixels::PixelFormatEnum;
 use sdl2::video::{Window, WindowContext};
@@ -480,6 +480,9 @@ impl Player {
                     _ => {},
                 };
             }
+            if let Event::MouseWheel {direction: MouseWheelDirection::Normal, x: 0, y, ..} = event {
+                self.seek(10, y > 0, dmx, disp_queue)?;
+            }
             if let Event::KeyDown {keycode: Some(keycode), keymod, ..} = event {
                 match keycode {
                     Keycode::Escape => {