LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Anyone know how to capture mouse click x and y coordinates? (https://www.linuxquestions.org/questions/programming-9/anyone-know-how-to-capture-mouse-click-x-and-y-coordinates-603795/)

aatwell 12-01-2007 03:04 PM

Anyone know how to capture mouse click x and y coordinates?
 
I am trying to capture mouse clicks and get the x and y coordinates, but I can't seem to find anyway of doing it in C. The books I have looked at don't talk about it and the one that did--it's code doesn't compile.

Please Help.
Andrew

paulsm4 12-01-2007 03:28 PM

The answer is "it depends".

The easiest approach would probably be to use a GUI library like GTK+ and use the library's functions to detect mouse clicks. Basically:

1. You would write a small "event handler"
2. You would register your event handler with the library
3. The library would call your handler every mouse click...giving
you the X, Y and button press as function parameters.

IMHO .. PSM


All times are GMT -5. The time now is 09:19 AM.