Robotjs: Please release the fixes

Created on 2 Dec 2020  路  2Comments  路  Source: octalmage/robotjs

Hey,
I really approciate for this package, but I would like to see the following fix in the release.
I was need to fork the repository and use npm link to reach this fix, but I would like to keep updated this package in the future.

Best regards,
Richard

https://github.com/octalmage/robotjs/blob/master/src/keypress.c#L17

#if defined(IS_WINDOWS)
    #define WIN32_KEY_EVENT_WAIT(key, flags) \
        (win32KeyEvent(key, flags), Sleep(DEADBEEF_RANDRANGE(63, 125)))
#elif defined(USE_X11)
    #define X_KEY_EVENT(display, key, is_press) \
        (XTestFakeKeyEvent(display, \
                           XKeysymToKeycode(display, key), \
                           is_press, CurrentTime), \
         XSync(display, false))
    #define X_KEY_EVENT_WAIT(display, key, is_press) \
        (X_KEY_EVENT(display, key, is_press), \
         microsleep(DEADBEEF_UNIFORM(62.5, 125.0)))
#endif

tapKey uses toggleKeyCode which calls WIN32_KEY_EVENT_WAIT once for a key and twice for a key with modifiers and therefore it can generate an additional delay of max 250ms.
i dunno why there is a extra sleep call. i forked the repository and removed it and it works fine.
< 2ms per call instead of 300ms +

_Originally posted by @Kyusung4698 in https://github.com/octalmage/robotjs/issues/530#issuecomment-570795846_

Most helpful comment

If you install with npm i git+https://github.com/octalmage/robotjs instead of npm i robotjs the issue is bypassed.

All 2 comments

If you install with npm i git+https://github.com/octalmage/robotjs instead of npm i robotjs the issue is bypassed.

Thank you, it's a good idea!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

poojas2288 picture poojas2288  路  5Comments

hrastnik picture hrastnik  路  8Comments

Multiply picture Multiply  路  6Comments

IChocolateKapa picture IChocolateKapa  路  12Comments

vnsharma-systango picture vnsharma-systango  路  9Comments