diff -uwd bonobo/bonobo-dock-item.c /usr/src/libbonoboui-2.8.1/bonobo/bonobo-dock-item.c
--- bonobo/bonobo-dock-item.c	2005-02-05 15:09:12.000000000 +0000
+++ /usr/src/libbonoboui-2.8.1/bonobo/bonobo-dock-item.c	2005-07-30 22:50:31.000000000 +0000
@@ -52,11 +52,10 @@
   GtkWidget *child;
   GtkWidget *grip;
 
-  GtkWidget *float_window;
-  GtkWidget *float_window_box;
   gboolean  float_window_hidden;
 };
 
+
 GNOME_CLASS_BOILERPLATE (BonoboDockItem, bonobo_dock_item,
 			 GtkBin, GTK_TYPE_BIN);
 
@@ -123,13 +122,6 @@
 static gboolean bonobo_dock_item_motion     (GtkWidget         *widget,
 					     GdkEventMotion    *event);
 
-static void bonobo_dock_item_float_window_size_request (GtkWidget *widget, GtkRequisition *requisition, gpointer data);
-static void bonobo_dock_item_float_window_size_allocate (GtkWidget *widget, GtkAllocation *allocation, gpointer data);
-
-static gboolean bonobo_dock_item_float_window_expose (GtkWidget *widget, GdkEventExpose *event, gpointer data);
-static gboolean bonobo_dock_item_float_window_button_changed (GtkWidget *widget, GdkEventButton *event, gpointer data);
-static gboolean bonobo_dock_item_float_window_motion (GtkWidget *widget, GdkEventMotion *event, gpointer data);
-
 static guint        dock_item_signals[LAST_SIGNAL] = { 0 };
 
 
@@ -339,7 +331,6 @@
   dock_item->_priv = g_new0 (BonoboDockItemPrivate, 1);
 
   dock_item->_priv->grip = bonobo_dock_item_grip_new (dock_item);
-  dock_item->_priv->float_window = NULL;
   dock_item->_priv->float_window_hidden = FALSE;
 
   gtk_widget_set_parent (dock_item->_priv->grip, GTK_WIDGET (dock_item));
@@ -456,12 +447,11 @@
   bin = GTK_BIN (widget);
   di = BONOBO_DOCK_ITEM (widget);
 
-  gdk_window_show (di->bin_window);
   if (! di->is_floating)
     gdk_window_show (widget->window);
-
-  if (di->is_floating && !di->float_window_mapped)
+  else if (!di->float_window_mapped)
     bonobo_dock_item_detach (di, di->float_x, di->float_y);
+  gdk_window_show (di->bin_window);  
 
   if (bin->child
       && GTK_WIDGET_VISIBLE (bin->child)
@@ -489,7 +479,7 @@
   gdk_window_hide (widget->window);
   if (di->float_window_mapped)
     {
-      gtk_widget_hide (GTK_WIDGET (di->_priv->float_window));
+      gdk_window_hide (di->float_window);
       di->float_window_mapped = FALSE;
       di->_priv->float_window_hidden = TRUE;
     }
@@ -541,42 +531,31 @@
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
   di->bin_window = gdk_window_new (widget->window, &attributes, attributes_mask);
   gdk_window_set_user_data (di->bin_window, widget);
+  attributes.x = 0;
+  attributes.y = 0;
+  attributes.width = widget->allocation.width;
+  attributes.height = widget->allocation.height;
+  attributes.window_type = GDK_WINDOW_TOPLEVEL;
+  attributes.event_mask |= (GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
+			    GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK |
+			    GDK_FOCUS_CHANGE_MASK | GDK_POINTER_MOTION_HINT_MASK |
+			    GDK_KEY_PRESS_MASK);
+  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+  di->float_window = gdk_window_new (gtk_widget_get_root_window (widget),
+									 &attributes,   attributes_mask);
+  gdk_window_set_decorations (di->float_window, 0);
+  gdk_window_set_type_hint (di->float_window, GDK_WINDOW_TYPE_HINT_TOOLBAR);
+  gdk_window_set_user_data (di->float_window, widget);
 
   if (GTK_BIN (di)->child)
     gtk_widget_set_parent_window (GTK_BIN (di)->child, di->bin_window);
 
   gtk_widget_set_parent_window (di->_priv->grip, di->bin_window);
 
-  di->_priv->float_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_screen (GTK_WINDOW (di->_priv->float_window), gtk_widget_get_screen (widget));
-  gtk_window_set_decorated (GTK_WINDOW (di->_priv->float_window), FALSE);
-
-  g_signal_connect (di->_priv->float_window, "size_allocate",
-		    G_CALLBACK (bonobo_dock_item_float_window_size_allocate),
-		    di);
-
-  g_signal_connect (di->_priv->float_window, "size_request",
-		    G_CALLBACK (bonobo_dock_item_float_window_size_request),
-		    di);
-  g_signal_connect (di->_priv->float_window, "expose_event",
-		    G_CALLBACK (bonobo_dock_item_float_window_expose),
-		    di);
-
-  g_signal_connect (di->_priv->float_window, "button_press_event",
-		    G_CALLBACK (bonobo_dock_item_float_window_button_changed),
-		    di);
-
-  g_signal_connect (di->_priv->float_window, "button_release_event",
-		    G_CALLBACK (bonobo_dock_item_float_window_button_changed),
-		    di);
-
-  g_signal_connect (di->_priv->float_window, "motion_notify_event",
-		    G_CALLBACK (bonobo_dock_item_float_window_motion),
-		    di);
-
   widget->style = gtk_style_attach (widget->style, widget->window);
   gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (di));
   gtk_style_set_background (widget->style, di->bin_window, GTK_WIDGET_STATE (di));
+  gtk_style_set_background (widget->style, di->float_window,GTK_WIDGET_STATE (di));
   gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
 
   if (di->is_floating)
@@ -598,15 +577,17 @@
   gdk_window_set_user_data (di->bin_window, NULL);
   gdk_window_destroy (di->bin_window);
   di->bin_window = NULL;
+  if (di->float_window_mapped)
+    bonobo_dock_item_unfloat (di);
+
+  gdk_window_set_user_data (di->float_window, NULL);
+  gdk_window_destroy (di->float_window);
+  di->float_window = NULL;
 
   if (di->_priv->float_window_hidden)
      di->float_window_mapped = TRUE;
 
-  if (di->float_window_mapped)
-    bonobo_dock_item_unfloat (di);
 
-  gtk_widget_destroy (GTK_WIDGET (di->_priv->float_window));
-  di->_priv->float_window = NULL;
 
   GNOME_CALL_PARENT (GTK_WIDGET_CLASS, unrealize, (widget));
 }
@@ -628,6 +609,7 @@
       gtk_style_set_background (widget->style, widget->window,
                                 widget->state);
       gtk_style_set_background (widget->style, di->bin_window, widget->state);
+      gtk_style_set_background (widget->style, di->float_window, widget->state);
       if (GTK_WIDGET_DRAWABLE (widget))
 	gdk_window_clear (widget->window);
     }
@@ -701,22 +683,6 @@
 }
 
 static void
-bonobo_dock_item_float_window_size_request (GtkWidget *widget,
-					    GtkRequisition *requisition,
-					    gpointer data)
-{
-  BonoboDockItem *dock_item;
-
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (requisition != NULL);
-
-  dock_item = BONOBO_DOCK_ITEM (data);
-
-  size_request (widget, requisition, dock_item);
-
-}
-
-static void
 grip_size_allocate (GtkWidget *widget,
                     GtkAllocation *allocation,
 		    GtkAllocation *child_allocation,
@@ -751,47 +717,7 @@
     gtk_widget_size_allocate (grip, &grip_alloc);
 }
 
-static void
-bonobo_dock_item_float_window_size_allocate (GtkWidget *widget,
-					     GtkAllocation *allocation,
-					     gpointer data)
-{
-  GtkBin *bin;
-  BonoboDockItem *di;
-  GtkRequisition child_requisition;
-  GtkAllocation child_allocation;
-  GtkWidget *child, *grip;
-  int border_width;
-  GList *list;
-
-  di = BONOBO_DOCK_ITEM (data);
-
-  bin = GTK_BIN(widget);
-  child = bin->child;
-  border_width = GTK_CONTAINER (widget)->border_width;
 
-  /* Grip and InternalToolbar are the children */
-  list = gtk_container_get_children (GTK_CONTAINER (child));
-
-  grip = list->data;
-
-  child_allocation.x = border_width;
-  child_allocation.y = border_width;
-
-  if (BONOBO_DOCK_ITEM_NOT_LOCKED(di))
-    grip_size_allocate (widget, allocation, &child_allocation, grip, di);
-
-  list = list->next;
-  child = list->data;
-
-  gtk_widget_get_child_requisition (child, &child_requisition);
-
-  child_allocation.width = child_requisition.width + 2 * border_width;
-  child_allocation.height = child_requisition.height + 2 * border_width;
-
-  gtk_widget_size_allocate (child, &child_allocation);
-
-}
 
 static void
 bonobo_dock_item_size_allocate (GtkWidget     *widget,
@@ -830,8 +756,6 @@
 
       if (BONOBO_DOCK_ITEM_NOT_LOCKED(di))
         grip_size_allocate (widget, allocation, &child_allocation,di->_priv->grip, di);
-
-      if (!di->is_floating)
         {
            child_allocation.width = MAX (1, (int) widget->allocation.width - 2 * border_width);
            child_allocation.height = MAX (1, (int) widget->allocation.height - 2 * border_width);
@@ -845,15 +769,17 @@
              }
 
 	    if (GTK_WIDGET_REALIZED (di))
-	      gdk_window_move_resize (di->bin_window,
-				    0,
-				    0,
+	  {
+	    gdk_window_move_resize (di->bin_window, 0, 0,
+				    widget->allocation.width,
+				    widget->allocation.height);
+	    if (di->float_window)
+	      gdk_window_resize (di->float_window,
 				    widget->allocation.width,
 				    widget->allocation.height);
           }
-
+      }
         gtk_widget_size_allocate (bin->child, &child_allocation);
-
        }
 }
 
@@ -862,33 +788,16 @@
 	      GdkEventExpose *event,
 	      BonoboDockItem *di)
 {
-
    GdkWindow *window;
    GtkWidget *grip;
    GtkContainer  *container;
 
-   if (!di->is_floating) {
-
       window = di->bin_window;
       container = GTK_CONTAINER (di);
       grip = di->_priv->grip;
 
-   } else {
-
-      GtkBin *bin;
-      GtkWidget *child;
-      GList *list;
-
-      bin = GTK_BIN (widget);
-      child = bin->child;
-      list = gtk_container_get_children (GTK_CONTAINER (child));
-
-      window = child->window;
-      grip = list->data;
-      container = GTK_CONTAINER (child);
-   }
-
    if (!event)
+  
     gtk_paint_box(widget->style,
                   window,
                   GTK_WIDGET_STATE (widget),
@@ -904,24 +813,20 @@
                   &event->area, widget,
                   "dockitem_bin",
                   0, 0, -1, -1);
+/*   */
 
   if (BONOBO_DOCK_ITEM_NOT_LOCKED (di))
       gtk_container_propagate_expose (
               container, grip , event);
+  if (di->is_floating)
+    {
+      gtk_container_propagate_expose (container, GTK_BIN (widget)->child,
+				      event);
 }
 
-static void
-bonobo_dock_item_float_window_paint (GtkWidget *widget,
-				     GdkEventExpose *event,
-				     gpointer data)
-{
-  BonoboDockItem *di;
+}
 
-  di = BONOBO_DOCK_ITEM (data);
 
-  if (di->is_floating)
-    window_paint (widget, event, di);
-}
 
 static void
 bonobo_dock_item_paint (GtkWidget      *widget,
@@ -930,30 +835,10 @@
   BonoboDockItem *di;
 
   di = BONOBO_DOCK_ITEM (widget);
-
-  if (!di->is_floating)
     window_paint (widget, event, di);
 
 }
 
-static gboolean
-bonobo_dock_item_float_window_expose (GtkWidget *widget,
-				      GdkEventExpose *event,
-				      gpointer data)
-{
-  g_return_val_if_fail (widget != NULL, FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
-
-  if (GTK_WIDGET_DRAWABLE (widget))
-    {
-      bonobo_dock_item_float_window_paint (widget, event, data);
-
-      if (GTK_WIDGET_CLASS (parent_class)->expose_event)
-              return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
-    }
-
-  return FALSE;
-}
 
 static gboolean
 bonobo_dock_item_expose (GtkWidget      *widget,
@@ -998,12 +883,7 @@
     {
       GtkWidget *child;
       gboolean in_handle;
-
-      if (!di->is_floating)
         child = di->_priv->child;
-      else
-        child = GTK_WIDGET (bonobo_dock_item_get_child (di));
-
       switch (di->orientation)
 	{
 	case GTK_ORIENTATION_HORIZONTAL:
@@ -1047,25 +927,6 @@
   return event_handled;
 }
 
-static gboolean
-bonobo_dock_item_float_window_button_changed (GtkWidget *widget,
-					      GdkEventButton *event,
-					      gpointer data)
-{
-
-  BonoboDockItem *di;
-
-  g_return_val_if_fail (widget != NULL, FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
-
-  di = BONOBO_DOCK_ITEM (data);
-
-  if (!BONOBO_DOCK_ITEM_NOT_LOCKED(di))
-    return FALSE;
-
-  return button_changed (widget, event, di);
-
-}
 
 static gboolean
 bonobo_dock_item_button_changed (GtkWidget      *widget,
@@ -1078,8 +939,8 @@
   g_return_val_if_fail (event != NULL, FALSE);
 
   di = BONOBO_DOCK_ITEM (widget);
-
-  if (event->window != di->bin_window)
+  if ((event->window != di->bin_window)
+      && (event->window != di->float_window))
     return FALSE;
 
   if (!BONOBO_DOCK_ITEM_NOT_LOCKED(widget))
@@ -1105,29 +966,15 @@
   new_x -= di->dragoff_x;
   new_y -= di->dragoff_y;
 
+  if (di->float_window_mapped)
+    bonobo_dock_item_drag_floating (di, new_x, new_y);
+
   g_signal_emit (GTK_WIDGET (di), dock_item_signals[DOCK_DRAG_MOTION], 0,
 		 new_x, new_y);
 
   return TRUE;
 }
 
-static gboolean
-bonobo_dock_item_float_window_motion (GtkWidget *widget,
-				      GdkEventMotion *event,
-				      gpointer data)
-{
-  BonoboDockItem *di;
-
-  g_return_val_if_fail (widget != NULL, FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
-
-  di = BONOBO_DOCK_ITEM (data);
-
-  if (!di->in_drag)
-    return FALSE;
-
-  return widget_motion (widget, event, di);
-}
 
 static gboolean
 bonobo_dock_item_motion (GtkWidget      *widget,
@@ -1140,11 +987,11 @@
   g_return_val_if_fail (event != NULL, FALSE);
 
   di = BONOBO_DOCK_ITEM (widget);
-
   if (!di->in_drag)
     return FALSE;
 
-  if (event->window != di->bin_window)
+  if ((event->window != di->bin_window)
+      && (event->window != di->float_window))
     return FALSE;
 
   return widget_motion (widget, event, di);
@@ -1197,8 +1044,8 @@
 static void
 bonobo_dock_item_set_floating (BonoboDockItem *item, gboolean val)
 {
+  if (item->behavior != BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING )	
   item->is_floating = val;
-
   /* If there is a child and it supports the 'is_floating' flag
    * set that too.
    */
@@ -1260,9 +1107,6 @@
 
   g_return_if_fail (callback != NULL);
 
-  if (di->float_window_mapped)
-    return; /* The owner of the widgets is the floating window, not the item */
-
   if (di->_priv->grip)
     callback (di->_priv->grip, callback_data);
 
@@ -1334,27 +1178,6 @@
 bonobo_dock_item_get_child (BonoboDockItem *item)
 {
     g_return_val_if_fail (BONOBO_IS_DOCK_ITEM (item), NULL);
-
-  if (item->is_floating)
-    {
-
-      GList *list;
-      GtkWidget *child = GTK_BIN (GTK_WIDGET (item->_priv->float_window))->child;
-
-      list = gtk_container_get_children (GTK_CONTAINER (child));
-
-      while (list)
-       {
-            GtkWidget *widget = list->data;
-
-            if (GTK_IS_TOOLBAR (widget))
-                return widget;
-
-            list = list->next;
-       }
-       g_assert_not_reached ();
-    }
-
    return GTK_BIN (item)->child;
 }
 
@@ -1563,22 +1386,14 @@
   g_assert (BONOBO_IS_DOCK_ITEM (item));
 
   item->in_drag = TRUE;
+  fleur = gdk_cursor_new_for_display (gtk_widget_get_display
+				      (GTK_WIDGET (item)), GDK_FLEUR);
 
-  fleur = gdk_cursor_new_for_display
-	  (gtk_widget_get_display (GTK_WIDGET (item)),
-	   GDK_FLEUR);
-
-  if (item->is_floating) {
-        /* This is not working well...can drag only
-           in the small region of the grip and the first button.
-           To be precise, it just sucks that we can't get a decent
-           grab on the grip itself
-        */
-
-        gdk_window = GTK_WIDGET (item->_priv->float_window)->window;
-  } else  {
+  if (item->is_floating)
+      gdk_window = item->float_window;    
+  else
         gdk_window = item->bin_window;
-  }
+    
   /* Hm, not sure this is the right thing to do, but it seems to work.  */
   while (gdk_pointer_grab (gdk_window,
                            FALSE,
@@ -1589,7 +1404,6 @@
                            fleur,
                            GDK_CURRENT_TIME) != 0);
 
-
   gdk_cursor_unref (fleur);
 }
 
@@ -1597,7 +1411,6 @@
 bonobo_dock_item_detach (BonoboDockItem *item, gint x, gint y)
 {
   BonoboDockItemPrivate *priv;
-  GtkWidget *widget;
 
   priv = item->_priv;
 
@@ -1617,54 +1430,21 @@
 
   if (!priv->float_window_hidden)
     {
-      if (item->orientation == GTK_ORIENTATION_HORIZONTAL)
-        priv->float_window_box = gtk_vbox_new (FALSE, 0);
-      else
-        priv->float_window_box = gtk_hbox_new (FALSE, 0);
-
-   /*
-
-    <michael> the size allocate etc. stuff looked dubious to me
-    <michael> we shouldn't be overriding size_allocate really when
-              we re-parent the grip into the floating toolbar box
-    <michael> it should all just work in that case, since there's no
-              need to knobble the GTK_BIN stuff,
-    <arvind>  by not overriding, the grip is not allocated
-    <michael> hmm,
-    <michael> it should be a child of the container,
-    <michael> we should override,
-    <michael> but not do a signal connection for the float_window
-
-   */
-
-      gtk_container_add (GTK_CONTAINER (item->_priv->float_window), priv->float_window_box);
-
-      widget = priv->grip; /* container_remove() will make priv->grip NULL, so we save it here */
-      g_object_ref (priv->grip);
-      gtk_container_remove (GTK_CONTAINER (item), priv->grip);
-      priv->grip = widget;
-      gtk_box_pack_start (GTK_BOX (priv->float_window_box), priv->grip, FALSE, FALSE, 0);
-      g_object_unref (priv->grip);
-
-      widget = priv->child;
-      g_object_ref (priv->child);
-      gtk_container_remove (GTK_CONTAINER (item), priv->child);
-      priv->child = widget;
-      gtk_box_pack_start (GTK_BOX (priv->float_window_box), priv->child, FALSE, FALSE, 0);
-      g_object_unref (priv->child);
+      gdk_window_hide (GTK_WIDGET (item)->window);
+      gdk_window_reparent (item->bin_window, item->float_window, 0, 0);
     }
-
-  gtk_window_move (GTK_WINDOW (item->_priv->float_window), x, y);
-  gtk_widget_show_all (GTK_WIDGET (item->_priv->float_window));
+  gdk_window_move (item->float_window, x, y);
+  gdk_window_show (item->float_window);
+  bonobo_dock_item_set_locked(item,FALSE);
 
   item->float_window_mapped = TRUE;
   item->_priv->float_window_hidden = FALSE;
 
-  gdk_window_hide (GTK_WIDGET (item)->window);
   gtk_widget_queue_draw (GTK_WIDGET (item));
-
-  gtk_window_set_transient_for (GTK_WINDOW (item->_priv->float_window),
-                                (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (item)))));
+  if (!GTK_WIDGET_HAS_FOCUS (priv->grip))
+    gtk_widget_grab_focus (priv->grip);
+  gdk_window_set_transient_for (item->float_window,
+				(gtk_widget_get_toplevel(GTK_WIDGET (item)))->window);
 
   g_signal_emit (item, dock_item_signals [DOCK_DETACH], 0);
 
@@ -1676,7 +1456,7 @@
 {
   BonoboDockItemPrivate *priv;
   gboolean is_realized;
-  GtkWidget *widget;
+
 
   priv = item->_priv;
 
@@ -1685,42 +1465,12 @@
   g_assert (priv->grip != NULL);
 
   is_realized = GTK_WIDGET_REALIZED (item);
+  g_assert (GDK_IS_WINDOW (item->float_window));
+  gdk_window_hide (item->float_window);
+  if (item->bin_window)
+	gdk_window_reparent (item->bin_window, GTK_WIDGET (item)->window, 0, 0);
 
-  /* Grip */
-  g_object_ref (priv->grip);
-  gtk_container_remove (GTK_CONTAINER (priv->float_window_box), priv->grip);
-
-  if (is_realized)
-    gtk_widget_set_parent_window (priv->grip, item->bin_window);
-
-  gtk_widget_set_parent (priv->grip, GTK_WIDGET (item));
-  g_object_unref (priv->grip);
-
-  /* Child */  
-  widget = priv->child;
-  g_object_ref (widget);
-  g_assert (item->bin.child == NULL);
-  gtk_container_remove (GTK_CONTAINER (priv->float_window_box), widget);
-  priv->child = NULL;
-
-  if (is_realized)
-    gtk_widget_set_parent_window (widget, item->bin_window);
-
-  /* priv->child must be NULL at this point, or bonobo_dock_item_add() barfs */
-  gtk_container_add (GTK_CONTAINER (item), widget);
-  
-  g_assert (item->bin.child == widget);
-  g_assert (priv->child == widget);
-  g_object_unref (widget);
-
-  /* Window */
-
-  gtk_widget_destroy (priv->float_window_box);
-  priv->float_window_box = NULL;
-
-  gtk_widget_hide (GTK_WIDGET (item->_priv->float_window));
   gdk_window_show (GTK_WIDGET (item)->window);
-
   item->float_window_mapped = FALSE;
   item->_priv->float_window_hidden = FALSE;
 
@@ -1754,7 +1504,7 @@
 {
   if (item->is_floating)
     {
-      gtk_window_move (GTK_WINDOW (item->_priv->float_window), x, y);
+      gdk_window_move (item->float_window, x, y);
 
       item->float_x = x;
       item->float_y = y;
@@ -1788,7 +1538,7 @@
 					gint *x, gint *y)
 {
   if (GTK_WIDGET_REALIZED (item) && item->is_floating)
-    gtk_window_get_position (GTK_WINDOW (item->_priv->float_window), x, y);
+    gdk_window_get_position (item->float_window, x, y);
   else
     {
       *x = item->float_x;
@@ -1806,4 +1556,3 @@
   else
     return item->_priv->grip;
 }
-
