What are the best way(s) to do it? Can ffi
, RubyCocoa, or MacRuby do it?
It seems like CGEventCreateMouseEvent
or CGPostMouseEvent
(deprecated) can be used.
Please give a working example. thanks.
Update: the title of this question updated...
In MacRuby your views can catch these events. Just look into the DotView
example that comes with MacRuby.
class MyView < NSView
def mouseUp event
puts convertPoint(event.locationInWindow, fromView:nil)
end
end