在mac os x中建立事件钩子

需求

建立监听系统范围的事件消息,实现EasyStroke,StrokeIt类似的功能

探索

Google “mac os hook”,会发现非常困难,除非是用进程注入的方法,可以使用的方法有 SIMBL(http://www.culater.net/software/SIMBL/SIMBL.php)和mach_start(https://github.com/rentzsch/mach_star),实现的功能是进程模块替换(http://www.core.dk/~lp/)

柳暗花明又一村, "Quartz event taps"可以为我们提供全局事件监听的能力

http://stackoverflow.com/questions/6657511/osx-carbon-quartz-event-taps-to-get-keyoard-input

https://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html

以此作为突破口,可以考虑实现mac下的鼠标手势程序. 是为记

posted on 2012-02-09 01:00  大宝pku  阅读(2664)  评论(0编辑  收藏  举报

导航