-
Notifications
You must be signed in to change notification settings - Fork 349
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
Improve nseventforwarder
#7229
Improve nseventforwarder
#7229
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I'm also happy to see the mutex gone :)
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MarkusPettersson98)
desktop/packages/nseventforwarder/nseventforwarder-rs/lib.rs
line 57 at r1 (raw file):
NSEventMask::LeftMouseDown | NSEventMask::RightMouseDown, &RcBlock::new(move |nsevent| { nsevent_callback(nsevent);
⛏️ This closure is redundant, you can pass nsevent_callback directly (if you change its return type)
&RcBlock::new(nsevent_callback)
33771c1
to
244b360
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 2 files reviewed, all discussions resolved (waiting on @hulthe)
desktop/packages/nseventforwarder/nseventforwarder-rs/lib.rs
line 57 at r1 (raw file):
Previously, hulthe (Joakim Hulthe) wrote…
⛏️ This closure is redundant, you can pass nsevent_callback directly (if you change its return type)
&RcBlock::new(nsevent_callback)
Nice one! ✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved
- Move `Arc` closer to actual use - Clearly separate the callback on nsveent from the nodejs callback - Name the NSEvent that macOS gives us
Create one `NSEventContext` per call to `start`, effectively allowing multiple, independenct callback to be registered at once.
244b360
to
c43ac26
Compare
This PR improves the
nseventforwarder
implementation in the following ways:Mutex
, effectively allowing multiple nsevent-callback to be running at once. Because why notThis is not critical in any way, but especially the static
Mutex
bothered me since it didn't seem necessary :-)This change is