Skip to content

Fix Context Mode failing sometimes #71

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

Closed
wants to merge 4 commits into from
Closed

Conversation

wrapperup
Copy link

@wrapperup wrapperup commented Nov 9, 2020

I noticed that in about 1/10 cases while pressing keys on my numpad keyboard, the key would fail to remap using the following AHK code:

image

During polling, the context state is set several times while a filtered device's keys get pressed. Looks like a race condition exists where AHK recognizes when a key gets pressed (when it checks cm.IsActive) and when the callback state gets set to 0, so to fix that I added a sleep before the context is set back to 0.

Haven't had a hitch yet with that change but I am trying some other ideas.

@wrapperup
Copy link
Author

wrapperup commented Nov 9, 2020

Quick update, I noticed this:

image

I think this may be a factor in causing the issue, gonna try with just this removed.

@wrapperup
Copy link
Author

I did a bit more testing and found that just removing the sleep was not enough, so I re-added the sleeps before setting the context back to 0.

@evilC
Copy link
Owner

evilC commented Jan 14, 2022

Apologies for not getting back to you on this - I did try various combinations before and never really found anything that relliably worked. Changing sleep values around seemed to fix some things and break others.
I have just made a major change in release 0.6.0 to how input is processed (See #75 ) which may make a difference. Also, I have noticed a potential flaw in how extended keycodes are processed which I plan on trying to address next.
It may be worth re-investigating the issues with context mode to see if the latest version has improved things

@wrapperup
Copy link
Author

No problem! Yeah, this PR may be irrelevant now (in retrospection, this PR only band-aided the issue...). Will try it out and let you know.

@wrapperup wrapperup closed this Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants