Re: [gtk-list] Q: How to optimize configure events?

On Mon, 10 Aug 1998, Daniel J. Kressin wrote:

> I'm writing a program that uses a pixmap in conjuction with a drawing area
> to speed redraws.  When the drawing area gets resized, I destroy the old
> pixmap, create a new one of the new size, and then draw the background
> (a semi-complex image) on it.  Future expose events then just copy the
> necessary area from the pixmap to the drawing area.  My problem is this:
> While the user is resizing the drawing area's window, multiple configure
> events are generated, each one causing the semi-complex image to get
> recreated at several "intermediate" sizes.  This causes jerky mouse
> response while trying to resize the window.
> My question is: Is there a way I can optimize the configure events so that
> only the "final" one causes the the semi-complex image to be created?

i guess, adding a one shot idle handler for the recreation would
reduce the flickering a lot. something like:

static idle_handler = 0;

static gboolean
my_func (gpointer data)
  [do recreation stuff here]
  idle_handler = 0;
  return FALSE;

static void
event_cb ()
  if (!idle_handler)
    idle_handler = gtk_idle_add (my_func, NULL);

> Dan 


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