GNOME Bugzilla – Bug 64428
GtkPlug / Socket oddness ...
Last modified: 2004-12-22 21:47:04 UTC
Date: Wed, 7 Nov 2001 01:38:06 -0500 (EST) From: Michael Meeks <michael@ximian.com> To: Owen Taylor <otaylor@redhat.com> Cc: Gtk Hackers <gtk-devel-list@gnome.org> Subject: more plug oddness ... Hi Owen, Everything is lovely out of proc with the new socket setup ie. your suggested: > gtk_plug_new (0); gtk_socket_add_id (gtk_plug_get_id (plug))? My only problem with this scheme, is working out how plug->socket_window gets set; in the in-proc case, so that when we hit: void _gtk_plug_add_to_socket (GtkPlug *plug, GtkSocket *socket) ... if (GTK_WIDGET_REALIZED (widget)) gdk_window_reparent (widget->window, plug->socket_window, 0, 0); plug->socket_window holds non-NULL and we have a chance of not just unparenting our GdkWindow. This looks a tad daft but FALSE == 0 -> NULL: - plug->socket_window = FALSE; + plug->socket_window = NULL; I'm also having issues with the plug's gdk window not being shown correctly; I have to have the following code to actualy see an embedded widget at all with the suggested sequence ( in-proc ): static void realize_cb (GtkWidget *socket, gpointer user_data) { GtkWidget *plug, *w; g_warning ("Realize"); plug = gtk_plug_new (0); w = gtk_button_new_with_label ("Baa"); gtk_widget_show_all (w); gtk_widget_show (plug); gtk_container_add (GTK_CONTAINER (plug), w); +++ GTK_PLUG (plug)->socket_window = GTK_WIDGET (socket)->window; gtk_socket_add_id (GTK_SOCKET (socket), gtk_plug_get_id (GTK_PLUG (plug))); +++ gdk_window_show (GTK_WIDGET (plug)->window); } ... socket = gtk_socket_new (); g_signal_connect (G_OBJECT (socket), "realize", G_CALLBACK (realize_cb), NULL); gtk_widget_show (GTK_WIDGET (socket)); gtk_box_pack_start (GTK_BOX (vbox), socket, TRUE, TRUE, 2); ... I have no clue why I need to show the gdk window to see ought, the socket_window kludge is detailed above. Am I being dopey again, or are these genine bugs, I'd really like to clean up bonobo_control_frame_set_remote_window. It seems that the suggested method is not actualy exercised in gtk+/test/testsocket which would perhaps be good. Regards, Michael.
Just extended testsocket in CVS to test this, and the bug is obvious. Will take a close look when I get a few minutes.
I'm checking in the following fixes that make testsocket work correctly; please check if it fixes for you. Mon Nov 19 17:11:23 2001 Owen Taylor <otaylor@redhat.com> (Fixes related to #64428, Michael Meeks) * gtk/gtkplug.c (gtk_plug_set_is_child): Unmap the widget, so it gets mapped again properly when we add to a parent. * gtk/gtkplug.c (_gtk_plug_add_to_socket): Set plug->socket_window. * gtk/gtkplug.c (_gtk_plug_remove_from_socket): Set socket_window to NULL, not FALSE.