configure-event and double buffering

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

 



I am trying to make an animated image:
----------------------------------------------
static gboolean exposeCanvas(GtkWidget *widget, GdkEventExpose *event, gpointer data) {
	cairo_t *cr = gdk_cairo_create (event->window);
	gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
	gdk_cairo_rectangle (cr, &event->area);
	cairo_fill (cr);
	cairo_destroy (cr);
	return FALSE;
}

static gboolean configureCanvas(GtkWidget *widget, GdkEventConfigure *event ) {
	if (pixmap) g_object_unref(pixmap);
pixmap = gdk_pixmap_new(widget->window, widget->allocation.width, widget->allocation.height, -1);
	return TRUE;
}

GtkWidget *canvas = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(mainWindow), canvas);
g_signal_connect(G_OBJECT(canvas), "expose_event", G_CALLBACK(exposeCanvas), NULL); g_signal_connect(G_OBJECT(canvas), "configure_event", G_CALLBACK(configureCanvas), NULL);
----------------------------------------------

It works fine on a static window, but when I actually change the size of the window the whole drawing area goes black for a moment.
What am I doing wrong?

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux