-
Notifications
You must be signed in to change notification settings - Fork 111
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
Move objc dependency to icrate #250
Conversation
I don't know why it is not working for you. I using VS Codium with |
You could also try a |
I'm using the same |
TLDR; You need to use Rust nightly for this project. Okay, that makes sense. The warnings are there because of the content of https://github.com/enigo-rs/enigo/blob/main/rustfmt.toml. On the nightly channel, comments are automatically wrapped so that you don't have to think about entering line breaks yourself. On the stable channel, this is not possible, hence the warnings. I just set my default to nightly with |
It is truly bugged it seems, I'm on the latest (nightly) version of The change that the |
@pentamassiv I reformatted the code with nightly |
Hmm, I don't know what is going on. Works on my machine ;-) Did you test if your changes still work? |
Sorry, I force pushed your branch to fix the issue. Do you want me to do it again so we are not stopped by the tooling? Now there are a few more commits and it is getting confusing ^^ |
I did test the changes, I ran all the examples and some variations of them, and even noticed one of them was missing a target conditional, which I included in the changes. But I think it could benefit from testing in more exotic scenarios, I just can't think of any out of the top on my head. If you have a suggestion of a more robust macOS scenario for testing, I would appreciate it. |
I am very sorry, I clicked to sync my local repository in VSCode and didn't think about how it would push the changes again. You can force push again, yes, that would be ideal. |
Alright, cool. I'll do that and merge it afterwards. Thank you for your PR :) Testing is a big issue with this crate. That's a problem on all platforms. There aren't many tests yet. There are some involving the browser to get feedback which keys were pressed/released and what the mouse did. The code is messy, it tests very little and we can only run it on Ubuntu with the Github Action. I'd love to fix that and be able to run the tests on macOS and Windows too. Then I would also put more effort into adding test cases. I wrote about some of the stuff I tried in #141. I paused my attempt of getting it to run for now. It is very annoying to do, because of the lack of insight you get from the Github runner. Maybe now that there is logging, it is easier. If you'd like a challenge after fixing the media keys on macOS, feel free to give it a try. It's one of the more difficult issue but would yield the biggest benefit. |
I've bookmarked the CI issue, I'll for sure try to tackle it in the future, thanks for the patience and mentoring in the first contribution. 😄 |
Sure, no problem. What happens if you format the code now? Does it still try to change it? It should not make any changes now. I noticed that you were working on your main branch. You might want to create a branch if you are working on a PR. That way it will be easier to rebase and if you have multiple things you are working on, you don't mix them. I also often forget doing that though |
Just cloned the og repo, and tried reformatting with On |
Looks like there is a issue which seems related to this problem of mine: rust-lang/rustfmt#5964. |
I'm opening this PR related to #249, but as it's my first contribution, I wanna take time to clear some doubts.
On macos_impl.rs:468 I had to add a
allow
directive because using theicrate
crate, I'm no longer required to create aClass
, and thus, apparently cannot fail theNSEvent
call, so I unnecessarily return a result from an infallible code. I'm not really sure this is the best approach.Another thing is, I've opted to go with
icrate
instead ofobjc2
directly, this is because, the code didn't really need that low of an access to Objective-C, so I figured that the better ergonomics oficrate
would benefit the project in terms of simplicity.One more thing is, should the usage of the
core_graphics
crate be kept? I'm not 100% sure, but I think that theobjc2
project (not the crate) has a substitute for this crate as well. If that's true, maybe I could give it a go trying to switch to it too.I've also fixed the
timer.rs
example, which had an target specific key being used in a general way.