desktop: Add fullscreen exit keyboard shortcut

Flash Player also exits fullscreen when escape is pressed.
This commit is contained in:
relrelb 2021-01-08 11:00:25 +02:00 committed by Mike Welsh
parent 030ff398ef
commit b2867aa3b9
1 changed files with 11 additions and 0 deletions

View File

@ -366,6 +366,17 @@ fn run_player(opt: Opt) -> Result<(), Box<dyn std::error::Error>> {
Some(_) => None,
});
}
WindowEvent::KeyboardInput {
input:
KeyboardInput {
state: ElementState::Pressed,
virtual_keycode: Some(VirtualKeyCode::Escape),
..
},
..
} => {
window.set_fullscreen(None);
}
WindowEvent::KeyboardInput { .. } | WindowEvent::ReceivedCharacter(_) => {
let mut player_lock = player.lock().unwrap();
if let Some(event) = player_lock