moses-palmer / pynput

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

Apple Silicon M2 Fixes #541

Open zmz223 opened 1 year ago

zmz223 commented 1 year ago

Combines #512 and re-reverts the changes made to darwin in PR #411 so that two listeners can run simultaneously on a mac with apple silicon.

moses-palmer commented 1 year ago

Thank you for your contribution, and I am sorry for this very long delay in feedback!

I no longer have access to any Apple hardware, so I have not been able to test pynput on macOS in quite a while. The lazy imports do seem to still be an issue, even though this was reportedly fixed in objc 8.0, so I see no reason not to merge those parts of the PR.

I am a bit curious, however, about 52b4e65b2570387b89aac2ca0d6536d5fd4f9bbc: to me it does not seem to do anything that relates to the M2 chip.

zmz223 commented 1 year ago

Hi Moses, Thanks so much for your response! I updated the PR to account for lazy imports in the Darwin mouse class which also are causing the same lazy import errors as in the keyboard. With regard to the Mac M2 issue, a race condition seems to be occurring in how threads are handled between UI libraries like PyQT and Tkinter and how pynput handles threading. I've tested the same application on a Mac with an Intel processor and the issue does not occur