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

[macOS] Add Mouse special key(Back, Forward) on macOS by button number #364

Merged

Conversation

IRONAGE-Park
Copy link
Contributor

Currently, macOS does not support input for mouse special keys.(Back, Forward)

To add this functionality, if the special input is of type OtherMouseUp / OtherMouseDown on macOS, send the mouse's number along with it so that special keystrokes can be supported.

This is a very simple way to do this.

Increase the number in last_moues_click by 2, from 7 to 9, since the total number of keys supported on macOS has increased.

It would be nice to specify that last_mouse_click should be incremented as the number of supported mouse keys increases, or to make it consistent via tests or types.
I realized later that the reason the test didn't pass in this fix was because of the "index out of bounds" of last_mouse_click

Copy link
Collaborator

@pentamassiv pentamassiv left a comment

Choose a reason for hiding this comment

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

Thank you for your PR! The code looks good and I only have a few minor suggestions.

It would also be nice to add it to our changelog (CHANGES.md), but I can also do that. The PR currently contains 5 commits. I'd prefer this to only be one commit. Please squash the commits, or I can do it when merging it.

@IRONAGE-Park IRONAGE-Park force-pushed the add/macos-mouse-special-keys branch from 45b2d81 to c4120e4 Compare November 27, 2024 03:01
@IRONAGE-Park IRONAGE-Park force-pushed the add/macos-mouse-special-keys branch from c4120e4 to 7845364 Compare November 27, 2024 03:03
@pentamassiv
Copy link
Collaborator

Great, thank you. I don't have a mac to test this on right now. Did you test it? If you use a browser and then simulate a press of the "Back" button, does the browser go to the previous page or what happens?

@IRONAGE-Park
Copy link
Contributor Author

enigo_test

This is an example of using mouse clicks in a project that references enigo, which I forked.

Here's Cargo.toml.

[package]
name = "enigo-test"
version = "0.1.0"
edition = "2021"

[dependencies]
enigo = { git = "https://github.com/IRONAGE-Park/enigo.git", branch = "add/macos-mouse-special-keys" }

@pentamassiv pentamassiv merged commit 367f890 into enigo-rs:main Nov 27, 2024
24 checks passed
@pentamassiv
Copy link
Collaborator

Awesome, thank you so much!

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