Nathan
Nathan

Reputation: 2980

Looking for a good example of Linux mouse programming in C

I am trying to get my feet wet in C, and I am curious to know how you can control the mouse pointer, and simulate a click, etc. To help myself learn, this would be a simple example where the keyboard arrows & spacebar would simulate these effects. I started here:

http://www.cprogrammingreference.com/Tutorials/Advance_Tutorials/mouseprogramming.php

But since I am in a linux environment, these obviously fail compiling.

#include <dos.h>
#include <graphics.h>

Is there a better example for me to start with in linux? Is it as simple as including different header files and using the same code, or are the routines completely different for linux (as one would expect)?

UPDATE Linux only would work great, as I am just learning.

Upvotes: 1

Views: 1659

Answers (1)

Paul
Paul

Reputation: 2769

http://snippets.dzone.com/posts/show/2750

That shows a quick snippet on simulating a mouse click. From there you can look into the other functions in the Xlib library.

Also there's a tool that does the same things you're talking about, you might want to take a look at its source if you want to know more about it.

http://www.semicomplete.com/projects/xdotool/

Upvotes: 1

Related Questions