什么是 MacOS API 到 "capture" 鼠标和键盘,VM 或远程桌面程序的方式?

What's the MacOS API to "capture" the mouse and keyboard, the way a VM or remote desktop program would do?

我正在寻找 Mac OS API 虚拟机或远程桌面类型的程序可以用来“捕获”鼠标和键盘。也就是说,我想编写一个 GUI 程序,当用户单击我的 window 时,正常的鼠标光标消失,所有键盘和鼠标输入都转移到我的程序,包括全局快捷键,如 cmd-tab .这个API叫什么名字?

发现:CGEventTapCreate 可以利用低级事件流来接收、过滤或插入 HID 事件。