moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.79k stars 248 forks source link

Is mouse press and release affecting the mouse movement? #373

Closed MrKuh closed 3 years ago

MrKuh commented 3 years ago

I made a clicker for minecraft, but I noticed that it effects my mouse movement.

Sometimes it feels like it gets stuck or moves by itself but only very minimal but noticeable.

I use a key and a mouse listener to click on hold and press and release to click a mouse button.

moses-palmer commented 3 years ago

Since you do not specify which operating system you use, I can only give you a generic answer.

The synthetic events emitted by pynput to simulate mouse clicks will generally contain a screen coordinate. This introduces a race, since the library first must read the current mouse position, then generate the fake event, and then dispatch it. If the mouse is moved after the position has been read, the click event will use old coordinates.