How to detect user activity (like a screensaver)
- From: BALLABIO GERARDO <GERARDO BALLABIO ESTERNI GRUPPO MPS IT>
- To: "gtkmm-list gnome org" <gtkmm-list gnome org>
- Subject: How to detect user activity (like a screensaver)
- Date: Wed, 11 May 2011 11:07:59 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]