Re: [gtk-list] Re: X and idles => incredible slowdowns



On Sat, Apr 29, 2000 at 12:07:43PM -0400, Havoc Pennington wrote:
> 
> Antonio Campos <acampos@extremadura.com> writes: 
> > Sorry, but this answer doesn't satisfy me. Windows does it right, why
> > shouldn't Linux?
> > 
> 
> See Paul's response. 
> 
> (And for a concrete example of Windows sucking because of the way it
> handles this, try moving a locked-up application around the
> screen. Oops!)

You can also make the Linux version suck much less with just a few
trivial changes to your program. 

Instead of using an idle function, make your function myidle() a
timeout with a very short delay (say 30 or 40ms), while increasing
your step size.

You are incrementing your angle by 0.005 per iteration, which comes
out to 2*pi/0.005=1256.6 iterations per revolution.  This is *way*
more than you need for the illusion of smooth motion.

With 
  angle += 0.005;
changed to
  angle += 2*M_PI/100; /* 100 iters per rev */
and 
  gtk_idle_add(myidle, (gpointer)w);
changed to
  gtk_timeout_add(40, myidle, (gpointer)w);
I get excellent interactive performance by X and still maintain the
illusion of smooth circular motion by the window.

-JT
 
-- 
GNU/Linux: Free your mind and your OS will follow.



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