Skip to content

Some input events get lost if many keys are held simultaneously #307

Closed

Description

@porglezomp

I also reported this on glutin as rust-windowing/glutin#941, but realized that it actually comes from here.
I'm on macOS 10.12.6, reproducing this with the latest winit on crates.io.

If I press many keys simultaneously, some events start getting lost. If I press ASDFGHJK, I only see events for ASDFGH. Similarly, if I hold down any two arrow keys, I don't get a press event for the third.

Reproducing with this code:

extern crate winit;

fn main() {
    let mut events_loop = winit::EventsLoop::new();
    let window = winit::Window::new(&events_loop).unwrap();

    events_loop.run_forever(|event| match event {
        winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => {
            winit::ControlFlow::Break
        }
        winit::Event::WindowEvent {
            event: winit::WindowEvent::KeyboardInput { input, .. }, ..
        } => {
            match input.virtual_keycode {
                Some(x) => println!("{:?} {:?}", x, input.state),
                None => println!("None {:?}", input.state),
            }
            winit::ControlFlow::Continue
        }
        _ => winit::ControlFlow::Continue,
    });
}

Activity

  1. mitchmindtree commented on Oct 6, 2017

    @mitchmindtree
    Contributor

    Thanks for the issue!

    I'd imagine this issue is more likely to do with your keyboard than it is winit - most keyboards have a ~6 key limit before presses start being ignored (I think there's a name for this limit but I've forgotten what it is). Could you test that you get the same behaviour with another program (maybe the garage band synth keyboard?) or perhaps another library?

  2. porglezomp commented on Oct 6, 2017

    @porglezomp
    Author

    It sounds like you're correct and this is the 6-key rollover. I'm not sure why the arrow-keys are differently limited at 2 (that was the suspicious part for me) but that also appears to be a hardware limitation. Thanks!

  3. added 2 commits that reference this issue on Jun 11, 2022
    9c2841f
    f5e19e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions