summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2023-07-02 16:29:12 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2023-07-02 16:29:12 +0200
commit2ef3529c3c4445ef99b0c2c1afadcb98803fa517 (patch)
treed2f3b0dbf7e40058588042f8a0365c4f816f6c53
parentab76e2d64bcbae9f855a184d5956880c7a89cedb (diff)
downloadnihav-player-2ef3529c3c4445ef99b0c2c1afadcb98803fa517.tar.gz
use mouse wheel to seek by ten seconds
-rw-r--r--videoplayer/src/main.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/videoplayer/src/main.rs b/videoplayer/src/main.rs
index a60c15d..d60f439 100644
--- a/videoplayer/src/main.rs
+++ b/videoplayer/src/main.rs
@@ -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 => {