InputBot
InputBot copied to clipboard
block_bind conflicts with is_pressed()
I've been tinkering trying to get this to work for a while, and I can't find a good approach. I'm wanting a way to block_bind a particular key, but still have the is_pressed() method recognize the key is held down "in real life" even though it isn't being propagated onward.
// Do not propagate the Capslock key onward at all
CapsLockKey.block_bind(|| ());
LKey.bind(|| {
//This check will always return false due to the block_bind
if CapsLockKey.is_pressed() { }
});
The only way I've managed to get it working is to create a second "fake" keyboard and selectively emit synthetic keyboard events on it, then not emit ANY events on the main keyboard. Is there a cleaner way?
@SonicZentropy I guess there is no cleaner way right now. One option could be to have InputBot track the keystate internally for blockable binds.
I think this is the problem
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644985(v=vs.85)
Note When this callback function is called in response to a change in the state of a key, the callback function is called before the asynchronous state of the key is updated. Consequently, the asynchronous state of the key cannot be determined by calling GetAsyncKeyState from within the callback function.
Is there been a update about this?