]> git.nihav.org Git - nihav-player.git/commitdiff
make player exit on shift+Q instead of Q
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 28 Jun 2023 17:13:38 +0000 (19:13 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 28 Jun 2023 17:13:38 +0000 (19:13 +0200)
videoplayer/src/main.rs

index 33d386ff9457955f6684139a0ec03eb13f476673..6becffd09bd7e897b3b40de86a10895a4d3797b8 100644 (file)
@@ -12,7 +12,7 @@ use std::thread;
 use std::sync::atomic::{AtomicU8, Ordering};
 
 use sdl2::event::{Event, WindowEvent};
-use sdl2::keyboard::Keycode;
+use sdl2::keyboard::{Keycode, Mod};
 use sdl2::mouse::MouseButton;
 use sdl2::render::{Canvas, Texture, TextureCreator};
 use sdl2::pixels::PixelFormatEnum;
@@ -476,9 +476,14 @@ impl Player {
             if let Event::MouseButtonDown {mouse_btn: MouseButton::Right, ..} = event {
                 self.toggle_pause();
             }
-            if let Event::KeyDown {keycode: Some(keycode), ..} = event {
+            if let Event::KeyDown {keycode: Some(keycode), keymod, ..} = event {
                 match keycode {
-                    Keycode::Escape | Keycode::Q => {
+                    Keycode::Escape => {
+                        self.end = true;
+                        println!();
+                        return Ok(true);
+                    },
+                    Keycode::Q if matches!(keymod, Mod::RSHIFTMOD | Mod::LSHIFTMOD) => {
                         self.end = true;
                         println!();
                         return Ok(true);