rust-windowing / rust-windowing/winit
No keyboard events received when building in exclusive fullscreen on macOS
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
Hello, I've just updated to the latest version and I'm not receiving keyboard events when a window is launched in exclusive fullscreen mode. The window doesn't seem to gain focus and I can still type in the terminal on my other monitor.
I noticed that if you first launch in windowed mode or borderless fullscreen mode, then switch to exclusive the events are received. I'm running the latest version of macOS (11.5.1) on my Mac Mini which has an Apple M1 processor.
use winit::event_loop::EventLoop;
use winit::window::{Fullscreen, WindowBuilder};
use winit::event::{Event, WindowEvent};
fn main() {
let event_loop = EventLoop::new();
let monitor = event_loop.primary_monitor().unwrap();
let video_mode = monitor.video_modes().next().unwrap();
let fullscreen = Some(Fullscreen::Exclusive(video_mode));
//let fullscreen = None; // It logs keyboard events as expected in windowed mode.
let _window = WindowBuilder::new().with_fullscreen(fullscreen).build(&event_loop).unwrap();
event_loop.run(move |event, _, _| {
match event {
Event::WindowEvent { event, .. } => match event {
WindowEvent::KeyboardInput { input, .. } => {
println!("{:?}", input); // Nothing is being logged.
}
_ => {},
}
_ => {},
}
});
}
Thanks
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied Rust reproducer on macOS with exclusive fullscreen, comparing it with windowed and borderless fullscreen modes. Trace the macOS fullscreen startup and focus path; done means the window gains focus and WindowEvent::KeyboardInput events are received immediately in exclusive fullscreen.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100