window background image problem



Hello.

I have a program which should load a xpm image and put it as the
background image of the window. Instead of that, the image blinks for a
second and then dissapears when the program is started. What is wrong?
The image is just a blue-filled rect.

The program:
---------------------------------
#include <gtk/gtk.h>

void window_realize(GtkWidget *widget, gpointer data)
{
        GdkPixmap *pixmap;
        pixmap = gdk_pixmap_create_from_xpm(GDK_DRAWABLE(widget->window), NULL,
NULL, "test1.xpm");
        gdk_window_set_back_pixmap(widget->window, pixmap, FALSE);
        
}

void window_show(GtkWidget *widget, gpointer data)
{
/*      GdkPixmap *pixmap;
        pixmap = gdk_pixmap_create_from_xpm(GDK_DRAWABLE(widget->window), NULL,
NULL, "test.xpm");
        gdk_window_set_back_pixmap(widget->window, pixmap, FALSE);*/
//      gdk_window_set_back_pixmap(widget->window, pixmap, FALSE);
        
}

void window_style(GtkWidget *widget, GtkStyle *previous, gpointer data)
{
        //gdk_window_set_back_pixmap(widget->window, pixmap, FALSE);
}

int main(int argc, char **argv)
{
        GtkWidget *window;
        
        gtk_init(&argc, &argv);


        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

        g_signal_connect_after(window, "realize", G_CALLBACK(window_realize),
NULL);
        //g_signal_connect_after(window, "style-set", G_CALLBACK(window_style),
NULL);
        //g_signal_connect(window, "show", G_CALLBACK(window_show), NULL);

        gtk_widget_show_all(window);

        gtk_main();
        return 0;
}
---------------------------------

Greets,
Luka




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