Re: How to detect user activity (like a screensaver)



Hi,

you might want to take a look at Pidgins-Sourcecode (it's GTK+, so very close to GTKmm). They have this functionallity to set the user-status to idle.
However, I believe they use a gnome-library and winapi for this...


Hi all,
I have a problem with a gtkmm application I'm writing, and need your help.

I need to activate a certain action after the user has been inactive for a given time, very much like a screensaver.

Of course I can't simply connect a timeout: if I do that, the connected function will be executed after the specified number of seconds, regardless of any user activity during that time. For it to work as intended, the timeout's clock should be reset every time the user moves the pointer, clicks, and so on. So I should write custom handlers for all relevant events (at least motion_notify and button_click), which would disconnect and reconnect the timeout. I guess that would work, but it's tedious and complicated.

Thus I wonder if there is an easier way. Screensavers work without requiring each and every application to send a message whenever they receive an event, so it must be possible. How do they do that? Can I use the same mechanism?

P.S. I'm running Debian stable so it's gtkmm 2, not 3.

Thank you in advance.
  Gerardo

--
Best regards,

michi7x7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]