Skip to content

Strange spurious key presses when using key::toggle #43

Description

@Pauan

Run the following code (warning it causes an infinite loop):

use std::thread::sleep;
use std::time::Duration;
use autopilot::key::Character;

loop {
    autopilot::key::toggle(&Character('s'), true, &[], 0);
    sleep(Duration::from_millis(100));
    autopilot::key::toggle(&Character('s'), false, &[], 0);

    sleep(Duration::from_millis(100));
}

This code will infinitely press the s key. While it is pressing the s key, repeatedly tap the y key on your keyboard.

You will see a pattern like this:

sssssssy;y;y;syy;y;y;y;y;yssy;y;y;sysy;y;y;y;y;yy;y;y;y;y;y;sssssssssssssysy;y;y;yy;y;y;y;yy;y;;sss

Even though the code is not pressing the ; key, and you did not press the ; key, it still causes spurious ; presses.

I don't know if this is a bug with autopilot, XTest, or perhaps my specific hardware. It's a very strange bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions