printf("embeded window = %li\n", XtWindow(embeded));
PRINTF("embeded window = %li\n", XtWindow(embeded));
gtk_xtbin_realize (GtkWidget *widget){  GdkWindowAttr attributes;  gint          attributes_mask, n;  GtkXtBin     *xtbin;  Arg           args[2];  gint          width, height;  Widget        top_widget;  Window        win;  Widget        embeded;  g_return_if_fail (GTK_IS_XTBIN (widget));  gdk_flush();  xtbin = GTK_XTBIN (widget);  if (widget->allocation.x == -1 &&      widget->allocation.y == -1 &&      widget->allocation.width == 1 &&      widget->allocation.height == 1)  {    GtkRequisition requisition;    GtkAllocation allocation = { 0, 0, 200, 200 };    gtk_widget_size_request (widget, &requisition);    if (requisition.width || requisition.height)    {      /* non-empty window */      allocation.width = requisition.width;      allocation.height = requisition.height;    }    gtk_widget_size_allocate (widget, &allocation);  }  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);  attributes.window_type  = GDK_WINDOW_CHILD;  attributes.x            = xtbin->x;  attributes.y            = xtbin->y;  attributes.width        = widget->allocation.width;  attributes.height       = widget->allocation.height;  attributes.wclass       = GDK_INPUT_OUTPUT;  attributes.visual       = gtk_widget_get_visual (widget);  attributes.colormap     = gtk_widget_get_colormap (widget);  attributes.event_mask   = gtk_widget_get_events (widget);  attributes.event_mask  |= GDK_EXPOSURE_MASK;  attributes_mask         = GDK_WA_X      | GDK_WA_Y |                             GDK_WA_VISUAL | GDK_WA_COLORMAP;  xtbin->width = attributes.width;  xtbin->height = attributes.height;  widget->window = gdk_window_new (xtbin->parent_window,                                   &attributes, attributes_mask);  /* Turn off any event catching for this window by */  /* the Gtk/Gdk event loop... otherwise some strange */  /* things happen */  XSelectInput(GDK_WINDOW_XDISPLAY(widget->window),                GDK_WINDOW_XWINDOW(widget->window),               0);  gdk_window_set_user_data (widget->window, xtbin);  widget->style = gtk_style_attach (widget->style, widget->window);  gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);  /* ensure all the outgoing events are flushed */  /* before we try this crazy dual toolkit stuff */  gdk_flush();  /***   * I'm sure there is a better way, but for now I'm    * just creating a new application shell (since it doesn't   * need a parent widget,) and then swapping out the XWindow   * from under it.  This seems to mostly work, but it's   * an ugly hack.   */  top_widget = XtAppCreateShell("drawingArea", "Wrapper",                                 applicationShellWidgetClass, xtbin->xtdisplay,                                 NULL, 0);  xtbin->xtwidget = top_widget;  /* set size of Xt window */  n = 0;  XtSetArg(args[n], XtNheight, xtbin->height);n++;  XtSetArg(args[n], XtNwidth,  xtbin->width);n++;  XtSetValues(top_widget, args, n);  embeded = XtVaCreateWidget("form", compositeWidgetClass, top_widget, NULL);  n = 0;  XtSetArg(args[n], XtNheight, xtbin->height);n++;  XtSetArg(args[n], XtNwidth,  xtbin->width);n++;  XtSetValues(embeded, args, n);  /* Ok, here is the dirty little secret on how I am */  /* switching the widget's XWindow to the GdkWindow's XWindow. */  /* I should be ashamed of myself! */  gtk_object_set_data(GTK_OBJECT(widget), "oldwindow",                      GUINT_TO_POINTER(top_widget->core.window)); /* save it off so we can get it during destroy */  top_widget->core.window = GDK_WINDOW_XWINDOW(widget->window);    /* this little trick seems to finish initializing the widget */  XtRegisterDrawable(xtbin->xtdisplay,                      GDK_WINDOW_XWINDOW(widget->window),                     top_widget);    XtRealizeWidget(embeded);#ifdef DEBUG_XTBIN  printf("embeded window = %li\n", XtWindow(embeded));#endif  XtManageChild(embeded);  /* now fill out the xtbin info */  xtbin->xtwindow  = XtWindow(embeded);  /* listen to all Xt events */  XSelectInput(xtbin->xtdisplay,                XtWindow(top_widget),                0x0FFFFF);  XSelectInput(xtbin->xtdisplay,                XtWindow(embeded),                0x0FFFFF);  XFlush(xtbin->xtdisplay);}