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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
06-17-2005, 11:15 AM
|
#1
|
|
LQ Newbie
Registered: Jun 2003
Location: Australia
Distribution: Mostly Debian (and Ubuntu)
Posts: 12
Rep:
|
Counting mouse clicks/movement and keyboard presses?
I am working on a Tcl UNIX client for SigX called TclSigX at the moment.
Basiclly what the client does is retrieve user and system stats from the computer it is installed in, format it so it looks neat and readable and send it to the SigX server, every couple of minutes. SigX then generates and updates an image with these statistics writen onto it, and you can use that image on a forum or email signature.
Anyway, I wanted to impliment a feature similar to one that the Windows clients have, which is to count the number of times the mouse has been clicked, scrolled and how far it has been moved, and how many times keys on the keyboard has been pressed.
As there are no (or at least stable) APIs to X for Tcl, the only solutions I can see to this problem is figuring this stuff out via some command, or making up a [C] helper program to come with TclSigX. I'd like to avoid making up a helper.
So, would anyone be able to help me out a bit here?
|
|
|
|
06-20-2005, 08:23 AM
|
#2
|
|
Member
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430
Rep:
|
Hey I `ve seen one such utility
Its a command by name
xev
And it does the job pretty well.It gives me the statistics of mouse click , release
Keyboard press,etc
But I am not sure whether its there in Tcl Unix or not.
Cheers
Z
|
|
|
|
01-21-2011, 01:12 AM
|
#3
|
|
Member
Registered: Feb 2010
Distribution: opensuse 11.2
Posts: 49
Rep:
|
Quote:
Originally Posted by zulfilee
xev
And it does the job pretty well.It gives me the statistics of mouse click , release
Keyboard press,etc
Z
|
could you show example of how to use it to achieve that result i really need it.
thanks
|
|
|
|
01-21-2011, 01:19 AM
|
#4
|
|
Member
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430
Rep:
|
Running just xev on the command prompt will create a window
If u click on the window the X,Y coordinates and the type of click will be displayed.
You can also use xev to get mouse related info from an existing window.
Ex:
You have a Xterm and you want to get mouse related info from that window
Go to the xterm
Type
xwininfo
THis will give you the windows id.
Then use
xev -id <windows_id>
to track the evens from window with window id <windowid>
|
|
|
|
01-21-2011, 01:28 AM
|
#5
|
|
Member
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430
Rep:
|
Also there is another command line tool call xmacro.
Its used for recording keyboard and mouse events and replay them.
I guess it should be useful for your query
Install xmacro [its a very small utility]
Run
xmacrorec2
Click the mouse anywhere and see the Button Number and coordinated getting logged.
|
|
|
|
01-21-2011, 02:05 AM
|
#6
|
|
Senior Member
Registered: Dec 2008
Location: Gurgaon, India
Distribution: OpenSUSE 11.4
Posts: 4,581
|
Quote:
Originally Posted by breadcrust
I am working on a Tcl UNIX client
....
Anyway, I wanted to impliment a feature similar to one that the Windows clients have, which is to count the number of times the mouse has been clicked, scrolled and how far it has been moved, and how many times keys on the keyboard has been pressed.
....
So, would anyone be able to help me out a bit here?
|
Google told me TCL is a language, but I don't know what is "Tcl UNIX"
You can write an interrupt handler for keyboard strokes:
http://www.linuxquestions.org/questi...2/#post3771000
This one runs from the user space, but it has termios struct, see for yourself if that works in your case.
http://www.linuxquestions.org/questi...1/#post3956458
and look at this too:
http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html
|
|
|
|
01-21-2011, 02:42 AM
|
#7
|
|
Senior Member
Registered: Dec 2008
Location: Gurgaon, India
Distribution: OpenSUSE 11.4
Posts: 4,581
|
  Now I realize the thread is from 2005!
|
|
|
|
01-22-2011, 09:11 AM
|
#8
|
|
Member
Registered: Feb 2010
Distribution: opensuse 11.2
Posts: 49
Rep:
|
Quote:
Originally Posted by zulfilee
Install xmacro [its a very small utility]
Run
xmacrorec2
|
i am using opensuse 11.2 and i have to install xmacro with tar.gz file and when first i use make command i 'v got some errors and i dont know why?and how can i resolve it?
this part of the errors:
Code:
xmacroplay.cpp: In function ‘void eventLoop(Display*, int)’:
xmacroplay.cpp:336: error: ‘cin’ was not declared in this scope
xmacroplay.cpp:340: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:340: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:346: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:346: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:352: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:352: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:358: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:358: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:364: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:364: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:370: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:370: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:376: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:376: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:382: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:382: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:385: error: ‘cerr’ was not declared in this scope
xmacroplay.cpp:395: error: ‘cout’ was not declared in this scope
xmacroplay.cpp:395: error: ‘endl’ was not declared in this scope
xmacroplay.cpp:398: error: ‘cerr’ was not declared in this scope
i really need to install it.thanks for your help
Last edited by hamedhsn; 01-22-2011 at 09:12 AM.
|
|
|
|
01-23-2011, 02:29 PM
|
#9
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
Quote:
Originally Posted by Anisha Kaul
  Now I realize the thread is from 2005!
|
And then people slag moderators off for pointing this out to people dragging it up from the dead. But instead you've ended up being tricked into wasting your time trying to help someone from 5 years ago...
|
|
|
|
01-23-2011, 03:03 PM
|
#10
|
|
Member
Registered: Sep 2007
Location: Mariposa
Distribution: Debian lenny, Slackware 12
Posts: 806
Rep: 
|
Quote:
Originally Posted by acid_kewpie
And then people slag moderators off for pointing this out to people dragging it up from the dead. But instead you've ended up being tricked into wasting your time trying to help someone from 5 years ago...
|
Well, no. They're also helping hamedhsn, who expressed an interest in the solution within the last day or so. He has taken over the mantle of the original poster.
|
|
|
|
01-23-2011, 07:31 PM
|
#11
|
|
Senior Member
Registered: Dec 2008
Location: Gurgaon, India
Distribution: OpenSUSE 11.4
Posts: 4,581
|
Quote:
Originally Posted by hamedhsn
Code:
xmacroplay.cpp: In function ‘void eventLoop(Display*, int)’:
xmacroplay.cpp:336: error: ‘cin’ was not declared in this scope
...
|
Try adding using namespace std; at the top of the file named 'xmacroplay.cpp', see if you get any different errors this time?
---------- Post added Jan 24th, 2011 at 07:02 ----------
Quote:
Originally Posted by acid_kewpie
And then people slag moderators off for pointing this out to people dragging it up from the dead.
|
But in this case the first helper is still active, so yet there is no reason for the thread closure 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:35 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|