Daniel Atallah wrote: > On 2/15/06, Matt Hull wrote: > > that like what gaim does ? > > Yes, gaim does essentially the same thing. > http://cvs.sourceforge.net/viewcvs.py/gaim/gaim/src/gtkidle.c?rev=1.12&view=markup > > > On Wed, 15 Feb 2006, Martyn Russell wrote: > > > Gossip needs to know how long the user has been idle (with no mouse > > > movement or key presses) for setting users to an away state, this might > > > be useful: > > > http://cvs.gnome.org/viewcvs/gossip/src/gossip-idle.c?rev=1.8&view=markup
A small addendum to the way I suggested (installing an own GPollFunc to keep track of whenever a main loop iteration occurs, see http://mail.gnome.org/archives/gtk-app-devel-list/2006-February/msg00164.html ) Possibly gtk_get_current_event() could help to determine whether the main loop iteration was triggered by any mouse or keyboard event or by something else, within a custom GPollFunc. This way would have two different features, compared two either writing a genuine screensaver module or the way Gaim & Co determine this: 1. it would work in a unique, platform-independent way, i.e. no need for any sort of #ifndef _WIN32 at all (even if the Win32 branch is very small, indeed) 2. it would determine the idle state of the GTK+ application only, not of the entire desktop (including events of / for other running apps). I understood the question as this could be the actual goal. However, for performance reasons, gtk_get_current_event_time() or gtk_get_event_widget() may be even better suited for this purpose, as they do without object allocation (and your requirement to deallocate it) within each main loop iteration. I think all main loop events that should reset your idle timer would be bound to any widgets of your application. So if the iteration has an associated widget (as keyboard and mouse events should do) you would likely reset the idle timer. If there's no widget you would increase or check your idle timer since probably other internal events trihggered the main loop iteration. See: http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html#gtk-get-current-event _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list