[wxPython] Catching mouse system-wide

Hello.

I'm writing an instant messaging software (http://www.nongnu.org/iruka). As with any IM, I detect the idle of user and the come back by looking at the mouse mouvement.

Right now I'm using EVT_MOUSE_EVENTS (related to wxMouseEvent) but the problem is, movements are catch only in app window. It means that when the window is not active I receive no event.

I found nothing in the doc about that. Is there any way to detect system-wide user activity with wxPython ?

In an other Jabber client, I've seen a guy looking at the linux log files to see if there were any activity... I don't want to have to do this kind of dirty and system-specific hack !

Thank you by advance,

···

--
Erwan Loisant
Ph.D. student (University of Nantes)
Research Student (Tokyo Metropolitan University)

Erwan Loisant wrote:

Right now I'm using EVT_MOUSE_EVENTS (related to wxMouseEvent) but the problem is, movements are catch only in app window. It means that when the window is not active I receive no event.

I found nothing in the doc about that. Is there any way to detect system-wide user activity with wxPython ?

If you want to do it by mouse position then you can set a timer and in the timer handler call wxGetMousePosition and check if it's changed since the last timeout.

In an other Jabber client, I've seen a guy looking at the linux log files to see if there were any activity... I don't want to have to do this kind of dirty and system-specific hack !

You'll want to do something besides just checking the mouse though as there are many things people can do on the computer without touching the mouse for long periods of time.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

I'm curious about this and have some questions:

1) Are you trying to determine if the user is "idle", the machine is
   "idle" or both? I suspect the former, but must agree with Robin
   that a motionless mouse does not mean an idle user.

2) What are you having your program do (or avoid) when the user is
   idle (or active)? I'm not very familiar with IMs so the "As with
   any IM" didn't really clarify it for me.

Basically, I'm guessing you might be able to avoid your whole problem
with a little more design discussion.
          -Michael

···

On Thu, Sep 19, 2002 at 02:12:14PM +0900, Erwan Loisant wrote:

I'm writing an instant messaging software (IRUKA: Cross-Platform Jabber Client).
As with any IM, I detect the idle of user and the come back by looking
at the mouse mouvement.

--
  Michael Stenner Office Phone: 919-660-2513
  Duke University, Dept. of Physics mstenner@phy.duke.edu
  Box 90305, Durham N.C. 27708-0305