moses-palmer / pynput

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

Suppress mouse move not working when using parsec #584

Closed kimkun07 closed 5 months ago

kimkun07 commented 5 months ago

Description When listening sequence of mouse input with suppress option, mouse position is fixed to first click.

Output of running To Reproduce script:

click (1164, 291, <Button.left: (4, 2, 0)>, True)
click (1164, 291, <Button.left: (4, 2, 0)>, False)
click (1164, 291, <Button.left: (4, 2, 0)>, True)
click (1164, 291, <Button.left: (4, 2, 0)>, False)
click (1164, 291, <Button.left: (4, 2, 0)>, True)
click (1164, 291, <Button.left: (4, 2, 0)>, False)

I was constantly moving my mouse and clicking. However, the position found in on_click method is not moving.

If I disable suppress option, I get desired output. (Position changing)

click (806, 477, <Button.left: (4, 2, 0)>, True)
click (806, 477, <Button.left: (4, 2, 0)>, False)
click (1431, 211, <Button.left: (4, 2, 0)>, True)
click (1431, 211, <Button.left: (4, 2, 0)>, False)
click (1451, 517, <Button.left: (4, 2, 0)>, True)
click (1451, 517, <Button.left: (4, 2, 0)>, False)

Is this expected behavior? How can I get sequence of input while suppressing the event?

Platform and pynput version OS: Windows 11 22H2 Python: 3.12.1 pynput: 1.7.6

To Reproduce

import time
from pynput import mouse

def on_click(*args):
    print("click", args)

with mouse.Listener(on_click=on_click, suppress=True):
    time.sleep(5)
kimkun07 commented 5 months ago

My mistake: I found out suppress was intended to not pass both click and move event to system.

Problem with Parsec I was using parsec (a remote desktop program), and it was the reason for my mistake. It appears that when using Parsec, mouse move event is not suppressed correctly, while mouse click event is suppressed correctly. As a result, I could still move my mouse even with the suppress option enabled, which should not have been the case.