Skip to content

Commit

Permalink
Fix the multi-window example handling every key event (#2589)
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0246 authored Oct 22, 2024
1 parent 50b3b7a commit 43a298e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/multi-window/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ use winit::{
application::ApplicationHandler,
event::{ElementState, KeyEvent, WindowEvent},
event_loop::{ActiveEventLoop, EventLoop},
keyboard::{Key, NamedKey},
window::{Window, WindowId},
};

fn main() -> Result<(), impl Error> {
let event_loop = EventLoop::new().unwrap();
let mut app = App::new(&event_loop);

println!("\nPress space to open a new window");

event_loop.run_app(&mut app)
}

Expand Down Expand Up @@ -365,6 +368,7 @@ impl ApplicationHandler for App {
WindowEvent::KeyboardInput {
event:
KeyEvent {
logical_key: Key::Named(NamedKey::Space),
state: ElementState::Pressed,
..
},
Expand Down

0 comments on commit 43a298e

Please sign in to comment.