Skip to content

Conversation

@roel-gerrits
Copy link

I have a mouse with thumb buttons, they when pressed they raise errors.

I fixed it in reply to: 43b69c8#commitcomment-295776

On unix systems all* buttons are now supported

tested on linux and windows, not tested on mac!

*) Left, middle, right, scroll-up -down -left -right and thumb-forward -backward

@pepijndevos
Copy link
Owner

Lucky you, I'm running a Mac.

It seems that not all buttons are supported by al systems? If the API has no support for thousands of buttons, so be it, but my mouse has these squeeze buttons no one uses, I'll look at the API if I can find something about that.

@roel-gerrits
Copy link
Author

I dont know for sure but mac.py on line 21 and 22 indicate so.

pressID = [None, kCGEventLeftMouseDown, kCGEventRightMouseDown, kCGEventOtherMouseDown]
releaseID = [None, kCGEventLeftMouseUp, kCGEventRightMouseUp, kCGEventOtherMouseUp]

@pepijndevos
Copy link
Owner

Okay, everything seems to work fine on Mac, but are you absolutely sure the button number are consistent on all platforms for both controlling and listening?

When I run a simple PyMouseEvent on Mac, I get number 3 on right, and 2 on both the middle and squeeze buttons. When I run tests/basic.py, 2 is the right click and 3 the middle one. Something strange is going on here.

It is said in the doc strings that 1 = left, 2 = right, 3 = middle. We should stick to that across all platforms for obvious reasons.

I also found out button numbers 3-31 are supplied on the event for kCGEventOtherMouseDown and Up, but I have yet to find a way to retrieve this number. Will you manage that as well, or should I do that, since I run a Mac?

@pepijndevos
Copy link
Owner

Ah, this returns the button number for a mouse event. n+1 is consistent with the docs.

CGEventGetIntegerValueField(event, kCGMouseEventButtonNumber)

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.

2 participants