From 28cfa91b40beb263528729e27f09e8b193e0a1d7 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Sat, 10 Apr 2021 16:15:38 +0200 Subject: [PATCH] examples/glupload: Close the window when Escape is pressed --- examples/src/bin/glupload.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/src/bin/glupload.rs b/examples/src/bin/glupload.rs index 428729fb9..b86e28f8e 100644 --- a/examples/src/bin/glupload.rs +++ b/examples/src/bin/glupload.rs @@ -618,7 +618,16 @@ fn main_loop(mut app: App) -> Result match event { - glutin::WindowEvent::CloseRequested => running = false, + glutin::WindowEvent::CloseRequested + | glutin::WindowEvent::KeyboardInput { + input: + glutin::KeyboardInput { + state: glutin::ElementState::Released, + virtual_keycode: Some(glutin::VirtualKeyCode::Escape), + .. + }, + .. + } => running = false, glutin::WindowEvent::Resized(logical_size) => { let dpi_factor = windowed_context.window().get_hidpi_factor(); windowed_context.resize(logical_size.to_physical(dpi_factor));