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

Cancel event when CGEventTap callback returns nullptr #665

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamnemecek
Copy link
Contributor

@adamnemecek adamnemecek commented Apr 5, 2024

Fixes #664. The fix is taken from https://github.com/tinyx3k/goxkey/blob/38f66edeb65e12a496a50fc700c89492b6215c94/src/platform/macos_ext.rs#L196C5-L213C6

This is absolutely necessary to filter events. Looking around github, returning NULL is a very common use case.

@adamnemecek adamnemecek changed the title Fixes #661 Fixes #664 Apr 5, 2024
@mrobinson mrobinson changed the title Fixes #664 Cancel event when CGEventTap callback returns nullptr Apr 8, 2024
@mattjbray
Copy link

See also #492

@adamnemecek
Copy link
Contributor Author

I guess that also works. It is disheartening that that PR been open since 2022.

@jrmuizel
Copy link
Collaborator

Is it possible to add a test that shows the problem?

@adamnemecek
Copy link
Contributor Author

The problem is that currently the api does not allow for consuming events.

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.

Incorrect behavior of CGEventTap
3 participants