Re: GtkFixed redraws
- From: John Cupitt <jcupitt gmail com>
- To: Matt Moseley <list_matt bellsouth net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GtkFixed redraws
- Date: Fri, 11 Feb 2005 13:46:59 +0000
On Thu, 10 Feb 2005 23:10:06 -0500, Matt Moseley
<list_matt bellsouth net> wrote:
I have an application where I dynamically add GtkButtons to a GtkFixed area. Whenever I add a button to
the fixed area, everything to the right of and below the top left of the button I'm adding gets cleared out
and then redrawn.
I made a test program ... this is flicker-free for me (gtk+-2.4.14,
linux). Click a button to add more buttons.
#include <stdio.h>
#include <gtk/gtk.h>
void
add_buttons (void *dummy, GtkWidget * fixed)
{
static int button_number = 0;
int i;
for (i = 0; i < 100; i++)
{
GtkWidget *but;
char buf[256];
snprintf (buf, 256, "Button %d", button_number++);
but = gtk_button_new_with_label (buf);
gtk_fixed_put (GTK_FIXED (fixed), but,
random () % 1000, random () % 1000);
g_signal_connect (but, "clicked", G_CALLBACK (add_buttons), fixed);
gtk_widget_show (but);
}
}
int
main (int argc, char **argv)
{
GtkWidget *window;
GtkWidget *fixed;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
fixed = gtk_fixed_new ();
gtk_container_add (GTK_CONTAINER (window), fixed);
gtk_widget_show_all (window);
add_buttons (NULL, fixed);
gtk_main ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]