bool UpdateStatus ()
{
if (!disposed && toolbarUpdaterRunning)
UpdateToolbars ();
else {
toolbarUpdaterRunning = false;
return false;
}
if (appHasFocus) {
int x, y;
Gdk.Display.Default.GetPointer (out x, out y);
if (x != lastX || y != lastY) {
// Mouse position has changed. The user is interacting.
lastX = x;
lastY = y;
RegisterUserInteraction ();
}
}
uint newWait;
double secs = (DateTime.Now - lastUserInteraction).TotalSeconds;
if (secs < 10)
newWait = 500;
else if (secs < 30)
newWait = 700;
else if (appHasFocus)
newWait = 2000;
else {
// The application seems to be idle. Stop the status updater and
// start a pasive wait for user interaction
StartWaitingForUserInteraction ();
return false;
}
if (newWait != statusUpdateWait && !waitingForUserInteraction) {
statusUpdateWait = newWait;
GLib.Timeout.Add (statusUpdateWait, new GLib.TimeoutHandler (UpdateStatus));
return false;
}
return true;
}