Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MouseDown after drag, instead of MouseUp #32

Open
ldemailly opened this issue Feb 6, 2022 · 6 comments · Fixed by ldemailly/gohook#1 · May be fixed by #33
Open

MouseDown after drag, instead of MouseUp #32

ldemailly opened this issue Feb 6, 2022 · 6 comments · Fixed by ldemailly/gohook#1 · May be fixed by #33

Comments

@ldemailly
Copy link

(Windows 11)
When you hold a mouse button (left == 1 for instance) and move the mouse events look like this:

hook: 0 2022-02-06 01:01:06.8846335 -0800 PST m=+9.886081101 - Event: {Kind: MouseHold, Button: 1, X: 1307, Y: 1232, Clicks: 1}
hook: 0 2022-02-06 01:01:07.6386065 -0800 PST m=+10.640054101 - Event: {Kind: MouseDrag, Button: 0, X: 1307, Y: 1233, Clicks: 0}
[...then a lot more of same... until one releases the button...]
hook: 0 2022-02-06 01:01:08.8920229 -0800 PST m=+11.893470501 - Event: {Kind: MouseDrag, Button: 0, X: 1487, Y: 1260, Clicks: 0}
[..this is the issue:...]
hook: 0 2022-02-06 01:01:09.2928355 -0800 PST m=+12.294283101 - Event: {Kind: MouseDown, Button: 1, X: 1487, Y: 1260, Clicks: 0}
hook: 0 2022-02-06 01:01:09.4931115 -0800 PST m=+12.494559101 - Event: {Kind: MouseMove, Button: 0, X: 1487, Y: 1259, Clicks: 0}

I'm pretty sure it should be MouseUp not MouseDown when one releases a button (like it does for KeyHold->KeyUp)?

Right now I'm working around using MouseDown for release (and I wonder who else) so we'd need to change the version tag once fixed

Thanks
Laurent

@vcaesar
Copy link
Member

vcaesar commented Feb 6, 2022

Thx, I will check it.

@ldemailly
Copy link
Author

gohook/hook/iohook.h

Lines 63 to 65 in d8ecd92

EVENT_MOUSE_CLICKED,
EVENT_MOUSE_PRESSED,
EVENT_MOUSE_RELEASED,

Seem swapped if that's how one is 6 and the other 8 in

gohook/hook.go

Lines 45 to 47 in 833856f

MouseUp = 6
MouseHold = 7
MouseDown = 8

ldemailly added a commit to ldemailly/gohook that referenced this issue Feb 6, 2022
ldemailly added a commit to ldemailly/gohook that referenced this issue Feb 6, 2022
Correct order to match underlying one

Fixes  robotn#32
@ldemailly ldemailly linked a pull request Feb 6, 2022 that will close this issue
@ldemailly ldemailly reopened this Feb 6, 2022
@ldemailly
Copy link
Author

(ignore my first MR was on my fork... but see #33 for the simple fix... assuming that doesn't break anything but it works for me, tested using

replace github.com/robotn/gohook => github.com/ldemailly/gohook v0.41.0-pre1
)

@ldemailly
Copy link
Author

Gentle ping

@SpeedReach
Copy link

how is this not fixed ...

@ldemailly
Copy link
Author

you can use my fork it has the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants