How to add a GtkWidget to an existing X-Window Widget hierarchy?



Hi,

i'm running on Linux 2.6.8 with gtk-2 and gcc 3.3.4

I have an existing X-Window application (Motif)
to which i want to add a GtkWidget.

I have for example plain X:

 ----------------------------------------
 Widget w_form = ...
 guint32 xid = XtWindow(w_form);
 ----------------------------------------

To add a gtk+ VBOX child to the above w_form i'm trying now since hours
approaches like:

 ----------------------------------------
 ...
 gtk_init(&argc, &argv);

 Display *xdisplay = XtDisplay(w_form);
 GdkDisplay *gdkDisplay = gdk_x11_lookup_xdisplay(xdisplay);
GdkWindow* gdkWindow = gdk_window_foreign_new_for_display(gdkDisplay, xid);

 vbox = gtk_vbox_new (FALSE, 0);
 gtk_container_add(GTK_CONTAINER(gdkWindow), vbox);
 ----------------------------------------

with no success.
How can i expand my X-Window Widgets with GtkWidgets?

Thank you for some help,

Marcel

PS: In fact i want to embed mozilla into my X app using
the gtk_socket_new() and gtk_plug_new(xid) approach in
the same executable. Is this possible? Is there a more simple approach?
We had a first running approach with gtk_plug_new(xid)running
under gtk-1.2 but this embedding fails with gtk-2 for some unknown
reason (nothing is displayed without any error message).






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