From: Kostya Shishkov Date: Sun, 2 Jul 2023 14:29:12 +0000 (+0200) Subject: use mouse wheel to seek by ten seconds X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=2ef3529c3c4445ef99b0c2c1afadcb98803fa517;p=nihav-player.git use mouse wheel to seek by ten seconds --- 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 => {