For XEMBED embedding add a _XEMBED_INFO property to the client with
Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
This commit is contained in:
		| @ -3,84 +3,40 @@ | ||||
|  | ||||
| #include <gtk/gtk.h> | ||||
|  | ||||
| void | ||||
| remove_buttons (GtkWidget *widget, GtkWidget *other_button) | ||||
| { | ||||
|   gtk_widget_destroy (other_button); | ||||
|   gtk_widget_destroy (widget); | ||||
| } | ||||
|  | ||||
| void | ||||
| add_buttons (GtkWidget *widget, GtkWidget *box) | ||||
| { | ||||
|   GtkWidget *add_button; | ||||
|   GtkWidget *remove_button; | ||||
|  | ||||
|   add_button = gtk_button_new_with_mnemonic ("_Add"); | ||||
|   gtk_box_pack_start (GTK_BOX (box), add_button, TRUE, TRUE, 0); | ||||
|   gtk_widget_show (add_button); | ||||
|  | ||||
|   gtk_signal_connect (GTK_OBJECT (add_button), "clicked", | ||||
| 		      GTK_SIGNAL_FUNC (add_buttons), | ||||
| 		      box); | ||||
|  | ||||
|   remove_button = gtk_button_new_with_mnemonic ("_Remove"); | ||||
|   gtk_box_pack_start (GTK_BOX (box), remove_button, TRUE, TRUE, 0); | ||||
|   gtk_widget_show (remove_button); | ||||
|  | ||||
|   gtk_signal_connect (GTK_OBJECT (remove_button), "clicked", | ||||
| 		      GTK_SIGNAL_FUNC (remove_buttons), | ||||
| 		      add_button); | ||||
| } | ||||
| extern guint32 create_child_plug (guint32  xid, | ||||
| 				  gboolean local); | ||||
|  | ||||
| int | ||||
| main (int argc, char *argv[]) | ||||
| { | ||||
|   guint32 xid; | ||||
|   guint32 plug_xid; | ||||
|  | ||||
|   GtkWidget *window; | ||||
|   GtkWidget *hbox; | ||||
|   GtkWidget *entry; | ||||
|   GtkWidget *button; | ||||
|   gtk_init (&argc, &argv); | ||||
|  | ||||
|   if (argc < 2) | ||||
|   if (argc != 1 && argc != 2) | ||||
|     { | ||||
|       fprintf (stderr, "Usage: testsocket_child WINDOW_ID\n"); | ||||
|       fprintf (stderr, "Usage: testsocket_child [WINDOW_ID]\n"); | ||||
|       exit (1); | ||||
|     } | ||||
|  | ||||
|   xid = strtol (argv[1], NULL, 0); | ||||
|   if (xid == 0) | ||||
|   if (argc == 2) | ||||
|     { | ||||
|       fprintf (stderr, "Invalid window id '%s'\n", argv[1]); | ||||
|       exit (1); | ||||
|       xid = strtol (argv[1], NULL, 0); | ||||
|       if (xid == 0) | ||||
| 	{ | ||||
| 	  fprintf (stderr, "Invalid window id '%s'\n", argv[1]); | ||||
| 	  exit (1); | ||||
| 	} | ||||
|        | ||||
|       create_child_plug (xid, FALSE); | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       plug_xid = create_child_plug (0, FALSE); | ||||
|       printf ("%d\n", plug_xid); | ||||
|       fflush (stdout); | ||||
|     } | ||||
|  | ||||
|   window = gtk_plug_new (xid); | ||||
|   gtk_signal_connect (GTK_OBJECT (window), "destroy", | ||||
| 		      (GtkSignalFunc) gtk_exit, NULL); | ||||
|   gtk_container_set_border_width (GTK_CONTAINER (window), 0); | ||||
|  | ||||
|   hbox = gtk_hbox_new (FALSE, 0); | ||||
|   gtk_container_add (GTK_CONTAINER (window), hbox); | ||||
|   gtk_widget_show (hbox); | ||||
|  | ||||
|   entry = gtk_entry_new (); | ||||
|   gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); | ||||
|   gtk_widget_show (entry); | ||||
|  | ||||
|   button = gtk_button_new_with_mnemonic ("_Close"); | ||||
|   gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); | ||||
|   gtk_widget_show (button); | ||||
|  | ||||
|   gtk_signal_connect_object (GTK_OBJECT (button), "clicked", | ||||
| 			     GTK_SIGNAL_FUNC (gtk_widget_destroy), | ||||
| 			     GTK_OBJECT (window)); | ||||
|  | ||||
|   add_buttons (NULL, hbox); | ||||
|    | ||||
|   gtk_widget_show (window); | ||||
|  | ||||
|   gtk_main (); | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Owen Taylor
					Owen Taylor