Connecting Tech Pros Worldwide Help | Site Map

Mouse Movement On Linux

Newbie
 
Join Date: Oct 2008
Posts: 13
#1: May 6 '09
Hey ,

I wonder how and which programming language I can use to capture movement of a mouse on Linux screen (not just on a particular webpage user is on) like how VB, C#,C++, and J# can be used to detect mouse movement on windows screen.

Thanks in advance
L
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,083
#2: May 20 '09

re: Mouse Movement On Linux


What are you developing?
What Linux flavour are you using?
What libraries are you using and what language to develop your application?
What have you tried so far to solve your problem?
Nepomuk's Avatar
Moderator
 
Join Date: Aug 2007
Location: Germany
Posts: 2,466
#3: May 26 '09

re: Mouse Movement On Linux


I can just run
Expand|Select|Wrap|Line Numbers
  1. sudo cat /dev/psaux
in a terminal and it will react to the mouse - it is a PS/2 mouse of course. Sometimes there's also a generic device /dev/mouse or something like that. Will that do the job?

Greetings,
Nepomuk
ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 389
#4: May 28 '09

re: Mouse Movement On Linux


Quote:

Originally Posted by Nepomuk View Post

I can just run

Expand|Select|Wrap|Line Numbers
  1. sudo cat /dev/psaux
in a terminal and it will react to the mouse - it is a PS/2 mouse of course. Sometimes there's also a generic device /dev/mouse or something like that. Will that do the job?

Greetings,
Nepomuk

/dev/psaux won't work, if you're using latest kernel.
It's been removed from 2.6 kernel..
Correct device is /dev/input/mice.
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,156
#5: Jun 12 '09

re: Mouse Movement On Linux


If you are familiar with the .NET world, you might look into MONO for linux.
Thing to remember (and it drove me nuts before I found it), attaching even handlers to the mouse move events(signals) is not enough, you actually have to enable the object to have that event (there's a property somewhere).

I am sure there is stuff in Xwindows libraries to deal with mouse as well
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,561
#6: Jun 12 '09

re: Mouse Movement On Linux


Do NOT use Mono/.NET. It would be a shame to load this boatload of a framework just to look at the mouse and you'll find lots of resistance to do so. In addition, it totally goes against the Unix Philosophy of coding programs.
Reply