servo / core-foundation-rs

Rust bindings to Core Foundation and other low level libraries on Mac OS X and iOS
Other
987 stars 216 forks source link

Cancel event when `CGEventTap` callback returns nullptr #665

Open adamnemecek opened 5 months ago

adamnemecek commented 5 months ago

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.

mattjbray commented 5 months ago

See also https://github.com/servo/core-foundation-rs/pull/492

adamnemecek commented 5 months ago

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

jrmuizel commented 3 months ago

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

adamnemecek commented 3 months ago

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