Re: How to add a GtkWidget to an existing X-Window Widget hierarchy?
- From: Marcel Ruff <mr marcelruff info>
- To: Kevin DeKorte <kdekorte yahoo com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: How to add a GtkWidget to an existing X-Window Widget hierarchy?
- Date: Sat, 02 Apr 2005 00:19:31 +0200
Hi Kevin,
thank you for the feedback.
But your code snippet fails in my case, see below:
Kevin DeKorte wrote:
On Thursday 31 March 2005 12:21 pm, Marcel Ruff wrote:
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).
Marcel,
I have the same issue in mplayerplug-in in that I cannot use a gtk_plug_new in
gtk2 (although it works in gtk1). I worked around it with this code (many
hours of bashing around to get something working, and it turns out to be
simple). A GTK_WINDOW_POPUP is an undecorated window.
GtkWidget *gtkwidget;
gtkwidget = gtk_window_new(GTK_WINDOW_POPUP);
XReparentWindow(GDK_WINDOW_XDISPLAY(gtkwidget->window),
GDK_WINDOW_XWINDOW(gtkwidget->window), x_window, 0,0);
The above line results in:
Gdk-WARNING **: gdkdrawable-x11.c:970 drawable is not a pixmap or window
Segmentation fault
What could be the reason (x_window is a XtWindow(XmForm Widget), the same
result when i try a XtWindow(XmDrawingArea Widget)).
thanks
Marcel
PS: I have posted a bug to bugzilla about the gtk_vbox_new():
Bug 172348
http://bugzilla.gnome.org
gtk_widget_map(gtkwidget);
Where "x_window" is a X window id.
Kevin
Visit: http://mplayerplug-in.sf.net
------------------------------------------------------------------------
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
http://www.xmlBlaster.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]