tags:

views:

126

answers:

2

Dears,

I have been developing a project which use web cam as source of input to imitate as mouse event on mac. I'm always handle with opencv for image processing and Qt framework for GUI framework.

My problem is, I want to write a program which imitates mouse. I don't know how to control a mouse out of the window form and sent the interrupt to the operating system. Is there any simple code? or could any one give me some hint?

Any comments will be appreciated. Thanks in advance, nofortee

A: 

For modern Operating Systems, a mouse is a fundamental input device. As such it's handled by a driver in the OS. There the mouse is tied closely to the pointer. For programmers like you, it's important to get the distinction between mouse and pointer right. It sounds like you actually want to control the pointer, not the mouse.

MSalters
Dear MSalters, I still having no clues about how to implement this, would you give me some specific about where should I start or where's the documents?Thanks for your great reply...
nofortee
I'm afraid that there's no existing document that describes precisely how to create a program that does what you want. You need a general understanding, not specifics. But it's hard to convey experience and understanding of OS architectures in a few lines.
MSalters
+1  A: 

One option is to use X11's XTEST extension and other Xlib functions.

To enable this on a mac read the answer from this question: http://stackoverflow.com/questions/1264210/does-mac-x11-have-the-xtest-extension

defaults write org.x.X11 enable_test_extensions -boolean true

Here is a tool already built using this technology: http://www.semicomplete.com/projects/xdotool/

UPDATE: Another option could be to use the built-in Automator tool.

zaf
I have read the question you gave me. And still no of nothing...could you give me some directions? please....thanks!!
nofortee
Well, where are you stuck?
zaf