Hopefully and easy question



Hi,

I'm new to GTK programming and I am having trouble with getting a GtkWindow to 
be parented by a normal XWindow

Here is the code I have written

instance->window is a Window type

            event_box = gtk_event_box_new();
            play_down_small_pb = gdk_pixbuf_new_from_xpm_data((const char 
**)play_down_small);
            image = gtk_image_new_from_pixbuf(play_down_small_pb);
            gtk_container_add (GTK_CONTAINER (event_box), image);
            
            win = (GtkWindow *)gtk_window_new(GTK_WINDOW_TOPLEVEL);  
            gtk_window_set_decorated(win,0);
            fixed = gtk_fixed_new();
            gtk_container_add(GTK_CONTAINER(win),fixed);
            gtk_widget_show(fixed);
            
gtk_fixed_put(GTK_FIXED(fixed),event_box,0,instance->embed_height-instance->panel_height);
            gtk_widget_show(image);
            gtk_widget_show(event_box);     
            gtk_widget_show((GtkWidget *)win);
            new_parent = gdk_window_foreign_new (instance->window);
            if (new_parent == NULL)
                g_warning ("lost parent window\n");
            gdk_window_reparent (GTK_WIDGET(win)->window, new_parent, 0, 0);

When I run this code, the GtkWindow is created, has the pixmap in it and 
undecorated, but it not owned by the window.

Any ideas what I did wrong?
Any pointers or tips would be great. I have been searching on google, but have 
not found anything that looked worth pursuing.

Kevin



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