Re: How to get GtkWindow associed with XID?



Owen Taylor wrote:

On Sun, 2005-05-15 at 13:16 +0200, jacktm wrote:
 

Hello.

I need do get the GtkWidget associated with XID. I thought
I can do it using gdk_window_foreign_new, but it doesn't
work for me. I tried many things, after googling I found
something like that:

   GtkWidget *toplevel = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   GdkWindow *gdk_win = gdk_window_foreign_new(xwin);
   gtk_widget_set_parent_window(toplevel, gdk_win);
   gtk_widget_show(toplevel);

But it creates new window and everything paints in that.
It looks like gtk_widget_set_parent_window doesn't work.
What am I doing wrong? Why doesn't it work for me?
   


It's not clear what you are trying to do here. GtkWidgets 
create their own X windows .... you can't reuse an
existing one.
 

Yes, that's what I need to do.

If you need to embed a GTK+ widget into a non-GTK+ 
application you'll need to implement the embedder side of 
the XEMBED protocol.

http://www.freedesktop.org/Standards/xembed-spec

Regards,
                                      Owen
 

But gdk_window_foreign_new wraps XID by GdkWindow.
What I need to do next is to wrap GdkWindow by GtkWindow.
Isn't it possible? It should be the same situation as
I have GdkWindow and I want to create GtkWidget as
child of GdkWindow. It should be possible, but it doesn't work
for me...

Thanks,
    Jack



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