Index: gtkdnd.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkdnd.c,v
retrieving revision 1.146
diff -u -r1.146 gtkdnd.c
--- gtkdnd.c	7 Mar 2006 17:48:07 -0000	1.146
+++ gtkdnd.c	14 Mar 2006 16:36:01 -0000
@@ -1,3 +1,4 @@
+/* -*- Mode: C; c-file-style: "gnu"; tab-width: 8 -*- */
 /* GTK - The GIMP Toolkit
  * Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
@@ -131,6 +132,7 @@
   guint              do_proxy : 1;
   guint              proxy_coords : 1;
   guint              have_drag : 1;
+  guint              accept_all : 1;
 };
   
 struct _GtkDragDestInfo 
@@ -1075,6 +1077,7 @@
   site->actions = actions;
   site->do_proxy = FALSE;
   site->proxy_window = NULL;
+  site->accept_all = FALSE;
 
   gtk_drag_dest_set_internal (widget, site);
 }
@@ -1115,6 +1118,7 @@
   site->do_proxy = TRUE;
   site->proxy_protocol = protocol;
   site->proxy_coords = use_coordinates;
+  site->accept_all = FALSE;
 
   gtk_drag_dest_set_internal (widget, site);
 }
@@ -1272,6 +1276,63 @@
   gtk_target_list_unref (target_list);
 }
 
+/**
+ * gtk_drag_dest_set_accept_all:
+ * @widget: a #GtkWidget that's a drag destination
+ * @accept_all: whether to accept all targets
+ * 
+ * Sets the widget to accept drags events from any source.
+ * Note that if there is a target list specified for this drag
+ * destination, it will be used before to determine a matching target.
+ *
+ * This may be used when a widget wants to do generic
+ * actions regardless of the targets that the source offers.
+ *
+ * Since: 2.10
+ **/
+void
+gtk_drag_dest_set_accept_all (GtkWidget *widget,
+			      gboolean   accept_all)
+{
+  GtkDragDestSite *site;
+
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+
+  site = g_object_get_data (G_OBJECT (widget), "gtk-drag-dest");
+
+  if (!site)
+    {
+      g_warning ("Can't call gtk_drag_dest_set_accept_all() "
+		 "until you've called gtk_drag_dest_set() "
+		 "to make the widget into a drag destination");
+      return;
+    }
+  else
+    site->accept_all = (accept_all == TRUE);
+}
+
+/**
+ * gtk_drag_dest_get_accept_all:
+ * @widget: a #GtkWidget that's a drag destination
+ * 
+ * Returns whether the widget is able to accept
+ * drags events from any drag source.
+ * 
+ * Return Value: TRUE if the widget accepts any drag event
+ *
+ * Since: 2.10
+ **/
+gboolean
+gtk_drag_dest_get_accept_all (GtkWidget *widget)
+{
+  GtkDragDestSite *site;
+
+  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+  site = g_object_get_data (G_OBJECT (widget), "gtk-drag-dest");
+  return (site) ? site->accept_all : FALSE;
+}
+
 /*************************************************************
  * _gtk_drag_dest_handle_event:
  *     Called from widget event handling code on Drag events
@@ -1352,7 +1413,7 @@
 	data.callback = (event->type == GDK_DRAG_MOTION) ?
 	  gtk_drag_dest_motion : gtk_drag_dest_drop;
 	data.time = event->dnd.time;
-	
+
 	gtk_drag_find_widget (toplevel, &data);
 
 	if (info->widget && !data.found)
@@ -1483,27 +1544,25 @@
   else
     {
       GtkDragDestSite *site;
+      guint target_info;
 
       site = g_object_get_data (G_OBJECT (drop_widget), "gtk-drag-dest");
 
-      if (site && site->target_list)
-	{
-	  guint target_info;
-
-	  if (gtk_target_list_find (site->target_list, 
-				    selection_data->target,
-				    &target_info))
-	    {
-	      if (!(site->flags & GTK_DEST_DEFAULT_DROP) ||
-		  selection_data->length >= 0)
-		g_signal_emit_by_name (drop_widget,
-				       "drag_data_received",
-				       context, info->drop_x, info->drop_y,
-				       selection_data,
-				       target_info, time);
-	    }
+      if (site && site->target_list &&
+	  gtk_target_list_find (site->target_list, 
+				selection_data->target,
+				&target_info))
+	{
+	  if (!(site->flags & GTK_DEST_DEFAULT_DROP) ||
+	      selection_data->length >= 0)
+	    g_signal_emit_by_name (drop_widget,
+				   "drag_data_received",
+				   context, info->drop_x, info->drop_y,
+				   selection_data,
+				   target_info, time);
 	}
-      else
+      else if (!site || !site->target_list ||
+	       site->accept_all)
 	{
 	  g_signal_emit_by_name (drop_widget,
 				 "drag_data_received",
@@ -1511,8 +1570,8 @@
 				 selection_data,
 				 0, time);
 	}
-      
-      if (site && site->flags & GTK_DEST_DEFAULT_DROP)
+
+      if (site && (site->accept_all || site->flags & GTK_DEST_DEFAULT_DROP))
 	{
 
 	  gtk_drag_finish (context, 
@@ -1927,7 +1986,7 @@
       return TRUE;
     }
 
-  if (site->flags & GTK_DEST_DEFAULT_MOTION)
+  if (site->accept_all || (site->flags & GTK_DEST_DEFAULT_MOTION))
     {
       if (context->suggested_action & site->actions)
 	action = context->suggested_action;
@@ -1945,7 +2004,7 @@
 		}
 	    }
 	}
-      
+
       if (action && gtk_drag_dest_find_target (widget, context, NULL))
 	{
 	  if (!site->have_drag)
@@ -1954,9 +2013,14 @@
 	      if (site->flags & GTK_DEST_DEFAULT_HIGHLIGHT)
 		gtk_drag_highlight (widget);
 	    }
-	  
+
 	  gdk_drag_status (context, action, time);
 	}
+      else if (site->accept_all)
+	{
+	  /* do not suggest any action here */
+	  gdk_drag_status (context, 0, time);
+	}
       else
 	{
 	  gdk_drag_status (context, 0, time);
@@ -1967,7 +2031,7 @@
   g_signal_emit_by_name (widget, "drag_motion",
 			 context, x, y, time, &retval);
 
-  return (site->flags & GTK_DEST_DEFAULT_MOTION) ? TRUE : retval;
+  return (site->accept_all || (site->flags & GTK_DEST_DEFAULT_MOTION)) ? TRUE : retval;
 }
 
 static gboolean
@@ -2052,23 +2116,23 @@
     {
       gboolean retval;
 
-      if (site->flags & GTK_DEST_DEFAULT_DROP)
+      if (site->accept_all || (site->flags & GTK_DEST_DEFAULT_DROP))
 	{
 	  GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
-      
-	  if (target == GDK_NONE)
+
+	  if (target != GDK_NONE)
+	    gtk_drag_get_data (widget, context, target, time);
+	  else if (!site->accept_all)
 	    {
 	      gtk_drag_finish (context, FALSE, FALSE, time);
 	      return TRUE;
 	    }
-	  else
-	    gtk_drag_get_data (widget, context, target, time);
 	}
 
       g_signal_emit_by_name (widget, "drag_drop",
 			     context, x, y, time, &retval);
 
-      return (site->flags & GTK_DEST_DEFAULT_DROP) ? TRUE : retval;
+      return (site->accept_all || (site->flags & GTK_DEST_DEFAULT_DROP)) ? TRUE : retval;
     }
 }
 
Index: gtkdnd.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkdnd.h,v
retrieving revision 1.18
diff -u -r1.18 gtkdnd.h
--- gtkdnd.h	18 May 2005 05:23:58 -0000	1.18
+++ gtkdnd.h	14 Mar 2006 16:36:01 -0000
@@ -1,3 +1,4 @@
+/* -*- Mode: C; c-file-style: "gnu"; tab-width: 8 -*- */
 /* GTK - The GIMP Toolkit
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
@@ -86,6 +87,10 @@
 void           gtk_drag_dest_add_text_targets  (GtkWidget    *widget);
 void           gtk_drag_dest_add_image_targets (GtkWidget    *widget);
 void           gtk_drag_dest_add_uri_targets   (GtkWidget    *widget);
+
+void           gtk_drag_dest_set_accept_all    (GtkWidget *widget,
+						gboolean   accept_all);
+gboolean       gtk_drag_dest_get_accept_all    (GtkWidget *widget);
 
 /* Source side */
 
Index: gtknotebook.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtknotebook.c,v
retrieving revision 1.196
diff -u -r1.196 gtknotebook.c
--- gtknotebook.c	8 Mar 2006 17:22:13 -0000	1.196
+++ gtknotebook.c	14 Mar 2006 16:36:07 -0000
@@ -161,16 +161,21 @@
   gint  mouse_y;
   gint  pressed_button;
   guint dnd_timer;
+  guint switch_tab_timer;
   GtkTargetList *source_targets;
   gboolean during_detach;
   gboolean has_scrolled;
 };
 
-static const GtkTargetEntry notebook_targets[] = {
+static const GtkTargetEntry notebook_source_targets [] = {
   { "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, 0 },
   { "application/x-rootwindow-drop", 0, 1 }
 };
 
+static const GtkTargetEntry notebook_dest_targets[] = {
+  { "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, 0 }
+};
+
 #ifdef G_DISABLE_CHECKS
 #define CHECK_FIND_CHILD(notebook, child)                           \
  gtk_notebook_find_child (notebook, child, G_STRLOC)
@@ -252,6 +257,9 @@
 					      gint              x,
 					      gint              y,
 					      guint             time);
+static void gtk_notebook_drag_leave          (GtkWidget        *widget,
+					      GdkDragContext   *context,
+					      guint             time);
 static gboolean gtk_notebook_drag_drop       (GtkWidget        *widget,
 					      GdkDragContext   *context,
 					      gint              x,
@@ -503,6 +511,7 @@
   widget_class->style_set = gtk_notebook_style_set;
   widget_class->drag_begin = gtk_notebook_drag_begin;
   widget_class->drag_motion = gtk_notebook_drag_motion;
+  widget_class->drag_leave = gtk_notebook_drag_leave;
   widget_class->drag_drop = gtk_notebook_drag_drop;
   widget_class->drag_data_get = gtk_notebook_drag_data_get;
   widget_class->drag_data_received = gtk_notebook_drag_data_received;
@@ -987,13 +996,16 @@
   priv->group_id = -1;
   priv->pressed_button = -1;
   priv->dnd_timer = 0;
-  priv->source_targets = gtk_target_list_new (notebook_targets,
-					      G_N_ELEMENTS (notebook_targets));
+  priv->switch_tab_timer = 0;
+  priv->source_targets = gtk_target_list_new (notebook_source_targets,
+					      G_N_ELEMENTS (notebook_source_targets));
 
   gtk_drag_dest_set (GTK_WIDGET (notebook),
 		     GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
-		     notebook_targets, G_N_ELEMENTS (notebook_targets),
+		     notebook_dest_targets, G_N_ELEMENTS (notebook_dest_targets),
                      GDK_ACTION_MOVE);
+
+  gtk_drag_dest_set_accept_all (GTK_WIDGET (notebook), TRUE);
 }
 
 static gboolean
@@ -1278,7 +1290,13 @@
       gtk_target_list_unref (priv->source_targets);
       priv->source_targets = NULL;
     }
-  
+
+  if (priv->switch_tab_timer)
+    {
+      g_source_remove (priv->switch_tab_timer);
+      priv->switch_tab_timer = 0;
+    }
+
   GTK_OBJECT_CLASS (parent_class)->destroy (object);
 }
 
@@ -2096,7 +2114,7 @@
 static gboolean
 gtk_notebook_arrow_button_press (GtkNotebook      *notebook,
 				 GtkNotebookArrow  arrow,
-				 GdkEventButton   *event)
+				 gint              button)
 {
   GtkWidget *widget = GTK_WIDGET (notebook);
   gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
@@ -2106,10 +2124,10 @@
   if (!GTK_WIDGET_HAS_FOCUS (widget))
     gtk_widget_grab_focus (widget);
   
-  notebook->button = event->button;
+  notebook->button = button;
   notebook->click_child = arrow;
-  
-  if (event->button == 1)
+
+  if (button == 1)
     {
       gtk_notebook_do_arrow (notebook, arrow);
       
@@ -2126,9 +2144,9 @@
 	  notebook->need_timer = TRUE;
 	}
     }
-  else if (event->button == 2)
+  else if (button == 2)
     gtk_notebook_page_select (notebook, TRUE);
-  else if (event->button == 3)
+  else if (button == 3)
     gtk_notebook_switch_focus_tab (notebook,
 				   gtk_notebook_search_page (notebook,
 							     NULL,
@@ -2207,6 +2225,30 @@
   return TRUE;
 }
 
+static GList*
+get_tab_at_pos (GtkNotebook *notebook, gint x, gint y)
+{
+  GtkNotebookPage *page;
+  GList *children = notebook->children;
+
+  while (children)
+    {
+      page = children->data;
+      
+      if (GTK_WIDGET_VISIBLE (page->child) &&
+	  page->tab_label && GTK_WIDGET_MAPPED (page->tab_label) &&
+	  (x >= page->allocation.x) &&
+	  (y >= page->allocation.y) &&
+	  (x <= (page->allocation.x + page->allocation.width)) &&
+	  (y <= (page->allocation.y + page->allocation.height)))
+	return children;
+
+      children = children->next;
+    }
+
+  return NULL;
+}
+
 static gboolean
 gtk_notebook_button_press (GtkWidget      *widget,
 			   GdkEventButton *event)
@@ -2214,9 +2256,8 @@
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
   GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
   GtkNotebookPage *page;
-  GList *children;
+  GList *tab;
   GtkNotebookArrow arrow;
-  gint num;
   gint x, y;
 
   if (event->type != GDK_BUTTON_PRESS || !notebook->children ||
@@ -2228,7 +2269,7 @@
 
   arrow = gtk_notebook_get_arrow (notebook, x, y);
   if (arrow)
-    return gtk_notebook_arrow_button_press (notebook, arrow, event);
+    return gtk_notebook_arrow_button_press (notebook, arrow, event->button);
 
   if (event->button == 3 && notebook->menu)
     {
@@ -2241,41 +2282,28 @@
     return FALSE;
 
   notebook->button = event->button;
-  num = 0;
-  children = notebook->children;
 
-  while (children)
+  if ((tab = get_tab_at_pos (notebook, x, y)) != NULL)
     {
-      page = children->data;
-      
-      if (GTK_WIDGET_VISIBLE (page->child) &&
-	  page->tab_label && GTK_WIDGET_MAPPED (page->tab_label) &&
-	  (x >= page->allocation.x) &&
-	  (y >= page->allocation.y) &&
-	  (x <= (page->allocation.x + page->allocation.width)) &&
-	  (y <= (page->allocation.y + page->allocation.height)))
-	{
-	  gboolean page_changed = page != notebook->cur_page;
-	  gboolean was_focus = gtk_widget_is_focus (widget);
+      gboolean page_changed, was_focus;
+
+      page = tab->data;
+      page_changed = page != notebook->cur_page;
+      was_focus = gtk_widget_is_focus (widget);
 	  
-	  gtk_notebook_switch_focus_tab (notebook, children);
-	  gtk_widget_grab_focus (widget);
+      gtk_notebook_switch_focus_tab (notebook, tab);
+      gtk_widget_grab_focus (widget);
 	  
-	  if (page_changed && !was_focus)
-	    gtk_widget_child_focus (page->child, GTK_DIR_TAB_FORWARD);
+      if (page_changed && !was_focus)
+	gtk_widget_child_focus (page->child, GTK_DIR_TAB_FORWARD);
 	  
-	  /* save press to possibly begin a drag */
-	  if (page->reorderable || page->detachable)
-	    {
-	      priv->during_detach = FALSE;
-	      priv->pressed_button = event->button;
-	      gtk_grab_add (widget);
-	    }
-
-	  break;
+      /* save press to possibly begin a drag */
+      if (page->reorderable || page->detachable)
+	{
+	  priv->during_detach = FALSE;
+	  priv->pressed_button = event->button;
+	  gtk_grab_add (widget);
 	}
-      children = children->next;
-      num++;
     }
 
   return TRUE;
@@ -2812,30 +2840,135 @@
 }
 
 static gboolean
+gtk_notebook_switch_tab_timeout (gpointer data)
+{
+  GtkNotebook *notebook;
+  GtkNotebookPrivate *priv;
+  GList *tab;
+  gint x, y;
+
+  notebook = GTK_NOTEBOOK (data);
+  priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
+
+  priv->switch_tab_timer = 0;
+  x = priv->mouse_x;
+  y = priv->mouse_y;
+
+  if ((tab = get_tab_at_pos (notebook, x, y)) != NULL)
+    {
+      /* FIXME: hack, we don't want the
+       * focus to move fom the source widget
+       */
+      notebook->child_has_focus = FALSE;
+      gtk_notebook_switch_focus_tab (notebook, tab);
+    }
+
+  return FALSE;
+}
+
+static gboolean
 gtk_notebook_drag_motion (GtkWidget      *widget,
 			  GdkDragContext *context,
 			  gint            x,
 			  gint            y,
 			  guint           time)
 {
-  GtkWidget *source_widget;
-  gint widget_group, source_widget_group;
-  
-  source_widget = gtk_drag_get_source_widget (context);
-  
-  g_assert (source_widget);
+  GtkNotebook *notebook;
+  GtkNotebookPrivate *priv;
+  GdkRectangle position;
+  GtkSettings *settings;
+  GtkNotebookArrow arrow;
+  guint timeout;
+  GdkAtom target, tab_target;
 
-  widget_group = gtk_notebook_get_group_id (GTK_NOTEBOOK (widget));
-  source_widget_group = gtk_notebook_get_group_id (GTK_NOTEBOOK (source_widget));
+  notebook = GTK_NOTEBOOK (widget);
+  target = gtk_drag_dest_find_target (widget, context, NULL);
+  tab_target = gdk_atom_intern_static_string ("GTK_NOTEBOOK_TAB");
 
-  if (widget_group != -1 &&
-      source_widget_group != -1 &&
-      widget_group == source_widget_group)
-    return TRUE;
+  if (target == tab_target)
+    {
+      gint widget_group, source_widget_group;
+      GtkWidget *source_widget;
 
-  gdk_drag_status (context, 0, time);
+      source_widget = gtk_drag_get_source_widget (context);
 
-  return FALSE;
+      g_assert (source_widget);
+
+      widget_group = gtk_notebook_get_group_id (notebook);
+      source_widget_group = gtk_notebook_get_group_id (GTK_NOTEBOOK (source_widget));
+
+      if (widget_group != -1 &&
+	  source_widget_group != -1 &&
+	  widget_group == source_widget_group)
+	{
+	  gdk_drag_status (context, GDK_ACTION_MOVE, time);
+	  return TRUE;
+	}
+    }
+
+  priv = GTK_NOTEBOOK_GET_PRIVATE (widget);
+  x += widget->allocation.x;
+  y += widget->allocation.y;
+
+  if (target == tab_target)
+    {
+      /* it's a tab, but doesn't share
+       * ID with this notebook */
+      gdk_drag_status (context, 0, time);
+    }
+
+  if (gtk_notebook_get_event_window_position (notebook, &position) &&
+      x >= position.x && x <= position.x + position.width &&
+      y >= position.y && y <= position.y + position.height)
+    {
+      priv->mouse_x = x;
+      priv->mouse_y = y;
+
+      arrow = gtk_notebook_get_arrow (notebook, x, y);
+
+      if (arrow)
+	return gtk_notebook_arrow_button_press (notebook, arrow, 1);
+
+      stop_scrolling (notebook);
+
+      if (!priv->switch_tab_timer)
+	{
+          settings = gtk_widget_get_settings (widget);
+
+          g_object_get (settings, "gtk-timeout-expand", &timeout, NULL);
+	  priv->switch_tab_timer = g_timeout_add (timeout,
+						  (GSourceFunc) gtk_notebook_switch_tab_timeout,
+						  widget);
+	}
+    }
+  else
+    {
+      if (priv->switch_tab_timer)
+	{
+	  g_source_remove (priv->switch_tab_timer);
+	  priv->switch_tab_timer = 0;
+	}
+    }
+
+  return TRUE;
+}
+
+static void
+gtk_notebook_drag_leave (GtkWidget      *widget,
+			 GdkDragContext *context,
+			 guint           time)
+{
+  GtkNotebookPrivate *priv;
+
+  priv = GTK_NOTEBOOK_GET_PRIVATE (widget);
+
+  if (priv->switch_tab_timer)
+    {
+      g_source_remove (priv->switch_tab_timer);
+      priv->switch_tab_timer = 0;
+    }
+
+  stop_scrolling (GTK_NOTEBOOK (widget));
 }
 
 static gboolean
@@ -2982,6 +3115,8 @@
 
       do_detach_tab (GTK_NOTEBOOK (source_widget), notebook, page_info, x, y);
       gtk_drag_finish (context, TRUE, FALSE, time);
+
+      return;
     }
 
   gtk_drag_finish (context, FALSE, FALSE, time);
Index: gtksettings.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtksettings.c,v
retrieving revision 1.90
diff -u -r1.90 gtksettings.c
--- gtksettings.c	22 Feb 2006 10:10:23 -0000	1.90
+++ gtksettings.c	14 Mar 2006 16:36:09 -0000
@@ -34,6 +34,7 @@
 
 #define DEFAULT_TIMEOUT_INITIAL 200
 #define DEFAULT_TIMEOUT_REPEAT   20
+#define DEFAULT_TIMEOUT_EXPAND  500
 
 typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
 
@@ -87,6 +88,7 @@
   PROP_SHOW_UNICODE_MENU,
   PROP_TIMEOUT_INITIAL,
   PROP_TIMEOUT_REPEAT,
+  PROP_TIMEOUT_EXPAND,
   PROP_COLOR_SCHEME,
   PROP_ENABLE_ANIMATIONS,
   PROP_TOUCHSCREEN_MODE,
@@ -451,6 +453,16 @@
 					     NULL);
 
   g_assert (result == PROP_TIMEOUT_REPEAT);
+
+  result = settings_install_property_parser (class,
+					     g_param_spec_int ("gtk-timeout-expand",
+ 							       P_("Expand timeout"),
+ 							       P_("Expand value for timeouts, when a widget is expanding a new region"),
+ 							       0, G_MAXINT, DEFAULT_TIMEOUT_EXPAND,
+ 							       GTK_PARAM_READWRITE),
+					     NULL);
+
+  g_assert (result == PROP_TIMEOUT_EXPAND);
 
   /**
    * GtkSettings:gtk-color-scheme:
