progrium / darwinkit

Native Mac APIs for Go. Previously known as MacDriver
MIT License
4.42k stars 147 forks source link

Can not create Event Taps #253

Closed tlindsay closed 2 months ago

tlindsay commented 2 months ago

I'm sure I'm missing something here–I'm new to Mac development. But I tried for several hours last night, and couldn't come up with a way to create an event tap. I don't see the CGEventTapCreate function anywhere in the documentation. Am I meant to import "C" to accomplish something like this?

I tried doing something like objc.Call[corefoundation.MachPortRef](...), but couldn't figure out a valid handle to give, and everything I tried panicked because the handle was nil.

I am using the 0.5.0-preview, so maybe the functions I need just haven't landed yet? I was just confused because all of the supporting constants/types (i.e., EventTapLocation, EventTapOptions, etc.) do exist.

progrium commented 2 months ago

We don't create function bindings yet, but yes you can use CGO in the meantime.

tlindsay commented 2 months ago

👍 Got it. Thanks for the reply!