InputBot icon indicating copy to clipboard operation
InputBot copied to clipboard

Unable to send KeySequence from a blockable bind.

Open jaspersmitNL opened this issue 1 year ago • 3 comments

Title: Program freezes when sending KeySequence from a blockable bind

Description: When attempting to send a KeySequence from a blockable bind in my program, the entire program freezes and locks the Windows input. This issue persists regardless of whether I block the input or not. Additionally, sending inputs using Enigo from a blockable bind (InputBot) also exhibits the same freezing behavior.

Steps to Reproduce:

  1. Use the following code snippet:
BKey.blockable_bind(move || {
    KeySequence("Hello, World!").send();
    BlockInput::DontBlock
})

Expected Behavior: The program should send the specified KeySequence without freezing or locking the input.

Actual Behavior: The program freezes and locks the Windows input.

Environment:

  • OS: Windows 11 (23H2)
  • Rust version: 1.76.0
  • InputBot: Branch develop, commit 2c506ab
  • Enigo: 0.1.3

jaspersmitNL avatar Feb 25 '24 12:02 jaspersmitNL

Read the comment in the blockable_bind example: https://github.com/obv-mikhail/InputBot/blob/develop/examples/blockable_binds.rs#L33

masonk avatar Feb 25 '24 14:02 masonk

I need to be able to send inputs from the same thread as that will return the block result value sadly. I'm building a scriptable macro system where using Lua I could register hooks like onKeyDown and there return a true or false based on if it has to cancel it. as well as do actions like send text etc from it.

jaspersmitNL avatar Feb 25 '24 16:02 jaspersmitNL

If I recall correctly, this is a limitation Windows, not of InputBot.

masonk avatar Feb 25 '24 17:02 masonk