Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Pauan opened this issue Dec 15, 2021 · 1 comment
Open

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

Pauan opened this issue Dec 15, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@Pauan
Copy link

Pauan commented Dec 15, 2021

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.

@Pauan
Copy link
Author

Pauan commented Dec 15, 2021

I also tested tfc, it has exactly the same problem with unicode_char_down, however ascii_char_down works perfectly fine. So it seems to be a bug in the conversion between Unicode -> key.

@msanders msanders added the bug Something isn't working label Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants