Re: window visibility notification

> > i have a program that updates a few labels very frequently based on some 
> > system stuff.  there is an idle function that uses up a great deal of 
> > processing power.  what i want to do is only have it update when it is on 
> > the screen, thereby reducing the amount of processor it takes up; if i want 
> > it to stop sucking resources, i'll just collapse it or move it to another 
> > desktop etc.

Use a timeout function [gtk_timeout_add(...)] instead of an idle; the
idle burns cpu every chance it gets but the user will not notice your
labels updating any faster than if you put them on a 50ms timeout,
which shouldn't strain your cpu at all.  (Remember the timeout
function has to return TRUE to keep getting called.)  


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