Hi, I'm trying to make something like this http://www.kksou.com/php-gtk2/sample-codes/place-a-background-image-in-GtkWindow-Part-6-align-bottom-right-GdkDrawable-draw_pixbuf.php but in C language. For now i just want to fill background image to it's cointainer (GtkLayout), because the container is bigger than image, image is displayed in tiles...
So, i make something like this: // Load model drawing from file. if((pixbuf = gdk_pixbuf_new_from_file("background.png", &error)) == NULL) { g_print("Error.\n"); return -1; } void on_layout_Home_expose_event(GtkWidget *widget, GdkEvent *event, gpointer user_data){ GtkAllocation allocation; GtkWidget *homeWindow; GdkPixmap *background; GtkStyle *style; int w = gdk_pixbuf_get_width(pixbuf); int h = gdk_pixbuf_get_height(pixbuf); gtk_widget_get_allocation(GTK_WIDGET(widget),&allocation); // Set picture as background. homeWindow = GTK_WIDGET(gtk_builder_get_object(builder, "layout_Home")); gdk_pixbuf_render_pixmap_and_mask (pixbuf, &background, NULL, 0); style = gtk_style_new (); //style->bg_pixmap[0] = background; gdk_draw_pixbuf(style->bg_pixmap[0],NULL,pixbuf,0,0,allocation.width-w-10,allocation.height-h-10,-1,-1,GDK_RGB_DITHER_NONE,0,0); gtk_widget_set_style (GTK_WIDGET(homeWindow), GTK_STYLE(style)); // if(gtk_container_get_children(widget) != NULL){ // gtk_widget_send_expose (gtk_container_get_children(widget),event); // } return TRUE; } But this doesn't work.. and it's normal that program return everytime to expose_event? Thanks --- Este e-mail foi verificado em termos de vírus pelo software antivírus Avast. https://www.avast.com/antivirus _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list