-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 01/15/10 16:51, Tristan Schmelcher wrote: > Hello, > > I'm a novice Gtk app developer writing a plugin for Firefox and I'm > having trouble getting the callbacks that I need from Gtk/Gdk. The way > the plugin architecture works is that Firefox creates a GtkSocket and > my plugin gets passed its XID and creates the corresponding GtkPlug > (in the same process). By and large everything works, except at > shutdown. In some cases, Firefox happens to do a gdk_window_destroy() > on one of the parent windows of the GtkSocket before unloading my > plugin (for example, when closing a tab with the 'X'). That > recursively destroys everything down to the GtkSocket and also the > GtkPlug in _gdk_window_destroy_hierarchy( > ). So when I try to access the underlying X11 Window handle after this > I get an error from the X server and the program aborts. :( > > What I'd like to do is receive a signal from Gtk/Gdk when the > GdkWindow inside my GtkPlug is destroyed like this so that I can > cancel any further rendering actions. But I can't figure out how to > receive a signal when this happens! AFAICT none of the GtkPlug signals > or its inherited GtkWidget signals are dispatched when this happens. > > Any ideas?
Tristan, I've had this same problem when developing gecko-mediaplayer/gnome-mplayer and mplayerplug-in. I was never able to fully use the GtkPlug interface. It just didn't work the way I needed it to. What I ended up doing is creating a normal toplevel window and then embedding it in the window that firefox gave me.. Something like this where windowid is the xid I get from firefox. window = gtk_window_new(GTK_WINDOW_TOPLEVEL); if (windowid > 0 && embedding_disabled == FALSE) { gtk_window_set_decorated(GTK_WINDOW(window), FALSE); GTK_WIDGET_SET_FLAGS(window, GTK_CAN_FOCUS); } if (windowid != 0 && embedding_disabled == FALSE) { while (gtk_events_pending()) gtk_main_iteration(); window_container = gdk_window_foreign_new(windowid); if (GTK_WIDGET_MAPPED(window)) gtk_widget_unmap(window); gdk_window_reparent(window->window, window_container, 0, 0); } Hope that helps. Kevin - -- Get my public GnuPG key from http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAktRA4AACgkQ6w2kMH0L1dFb0ACfdc7jssfzEnillFHhrUFOjDbW nsQAnj4Q6GCxg8H1zeoC9/NTx8kuRtDV =iMWg -----END PGP SIGNATURE----- _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list