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

Correct the order of MouseUp and MouseDown #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ldemailly
Copy link

Fixes #32 (verified on Windows 11)

Copy link
Member

@vcaesar vcaesar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this changed break other mouse event, and can't listening MouseDown before drag too.

@ldemailly
Copy link
Author

But this changed break other mouse event, and can't listening MouseDown before drag too.

Sorry I am not following, what does break? (can you give an example)

@vcaesar
Copy link
Member

vcaesar commented Feb 28, 2022

You can click mouse, and the mouse down and up is not right.

@ldemailly
Copy link
Author

which os? for me it works with the PR changes on Windows 11

@vcaesar
Copy link
Member

vcaesar commented Mar 2, 2022

Mac os. And the PR should be tested before merge.

@ldemailly
Copy link
Author

Well I just tested on Max OS and same, it only works the way I need for my patch

Try:

https://github.com/ldemailly/gohook_sample/blob/main/mouseIssue.go

note that the issue is the missing mouse Up, if you click and hold; the end (release) should be MouseUp and with your original code it's MouseDown

This being said with my patch it's both

with your original code: click and hold, then release:

16:25:04 I mouseIssue.go:20> Mouse Button 1 down (hold)
16:25:05 I mouseIssue.go:27> Mouse Button 1 down event

(ie my issue #32)

with your original code: quick tap/click: (without holding/dragging):

16:26:20 I mouseIssue.go:20> Mouse Button 1 down (hold)
16:26:20 I mouseIssue.go:27> Mouse Button 1 down event
16:26:20 I mouseIssue.go:25> Mouse Button 1 released

with my change: (with the replace in go.mod)

click and hold; then release:

16:28:11 I mouseIssue.go:20> Mouse Button 1 down (hold)
16:28:13 I mouseIssue.go:25> Mouse Button 1 released

which is what I need/expect

but yes quick tap:

16:28:53 I mouseIssue.go:20> Mouse Button 1 down (hold)
16:28:53 I mouseIssue.go:25> Mouse Button 1 released
16:28:53 I mouseIssue.go:27> Mouse Button 1 down event

the down event is unreliable as it's missing anyway when holding

but release should be

@ldemailly
Copy link
Author

If you have a better fix for #32 that sounds great and close this one

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

Successfully merging this pull request may close these issues.

MouseDown after drag, instead of MouseUp
2 participants