LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-01-2007, 03:04 PM   #1
aatwell
Member
 
Registered: Apr 2007
Location: San Jose, CA
Posts: 31

Rep: Reputation: 15
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
 
Old 12-01-2007, 03:28 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simulating a mouse click Sheridan Programming 10 12-02-2019 03:11 PM
Wireless mouse/kboard combo - require a click everytime for mouse to work godfrank Linux - Hardware 2 10-02-2006 06:26 PM
GIMP does not negative coordinates in a .eps leontini Linux - Software 1 12-18-2005 01:46 PM
mouse: single-click becomes double-click kinzlaw Linux - Hardware 2 08-24-2005 07:55 PM
X freezes on mouse click. bruno buys Debian 3 09-23-2004 02:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration