repeats / Repeat

Cross-platform mouse/keyboard record/replay and automation hotkeys/macros creation, and more advanced automation features.
Apache License 2.0
1.03k stars 76 forks source link

macos mouse button register #41

Closed deniz-ozkan closed 1 year ago

deniz-ozkan commented 1 year ago

On macos 13.2.1 when I release left mouse button, it sends 4096 value to the release function instead of 1024. that causes left click to stuck.

hptruong93 commented 1 year ago

Could you clarify? What is sending 4096 value to the release function? If you wrote some code, would you be able to include it (or have a sample code snippet that reproduces the problem)?

deniz-ozkan commented 1 year ago

This is the small part of the macro that I recorded. As you can see when I press left mouse button it registers as left click, however when I release it, it is registered as right click.

mouse move to (350, 135) wait for 83 milliseconds mouse press left button at current position wait for 83 milliseconds mouse release right button at current position wait for 187 milliseconds

The 4096 value that i was talking about can be seen when I generate source code in java or python.

/Begin generated code/ c.mouse().move(350, 135); c.blockingWait(83); c.mouse().press(1024); c.blockingWait(83); c.mouse().release(4096); c.blockingWait(187);

I also tried it on windows 11 and had no problem. I am using 5.6.4 version.

hptruong93 commented 1 year ago

Took a while to find the issue, but I found it https://github.com/repeats/SimpleNativeHooks/blob/master/src/org/simplenativehooks/osx/OSXNativeMouseEvent.java#L41

This should be BUTTON1_DOWN_MASK. I'll send a fix.

hptruong93 commented 1 year ago

Should be fixed with c792b270be93c7a6a188d32b3db593b564764bdb. I verified this works on a Mac.

I added a new pre-release v5.7.1 that includes this fix.