Index: libwnck/pager.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/pager.c,v
retrieving revision 1.40
diff -u -r1.40 pager.c
--- libwnck/pager.c	4 Oct 2004 03:51:39 -0000	1.40
+++ libwnck/pager.c	4 Jan 2005 15:36:44 -0000
@@ -31,6 +31,7 @@
 
 
 #define N_SCREEN_CONNECTIONS 11
+#define TIMEOUT_ACTIVATE 1000
 
 struct _WnckPagerPrivate
 {
@@ -59,6 +60,8 @@
   GdkPixbuf *bg_cache;
 
   int layout_manager_token;
+  guint dnd_activate;
+  WnckWorkspace *dnd_workspace;
 };
 
 enum
@@ -88,6 +91,12 @@
                                           GdkEventExpose   *event);
 static gboolean wnck_pager_button_press  (GtkWidget        *widget,
                                           GdkEventButton   *event);
+static gboolean wnck_pager_drag_motion   (GtkWidget        *widget,
+                                          GdkDragContext   *context,
+                                          gint              x,
+                                          gint              y,
+                                          guint             time);
+static gboolean wnck_pager_drag_motion_timeout (gpointer data);
 static gboolean wnck_pager_motion        (GtkWidget        *widget,
                                           GdkEventMotion   *event);
 static gboolean wnck_pager_button_release (GtkWidget        *widget,
@@ -101,6 +110,9 @@
                                           WnckScreen *screen);
 static void wnck_pager_connect_window    (WnckPager  *pager,
                                           WnckWindow *window);
+static void wnck_pager_drag_motion_leave (GtkWidget        *widget,
+                                          GdkDragContext   *context,
+                                          guint             time);
 static void wnck_pager_disconnect_screen (WnckPager  *pager);
 
 static void wnck_pager_set_layout_hint   (WnckPager  *pager);
@@ -160,6 +172,7 @@
   pager->priv->workspace_size = 48;
   pager->priv->bg_cache = NULL;
   pager->priv->layout_manager_token = WNCK_NO_MANAGER_TOKEN;
+  gtk_drag_dest_set (GTK_WIDGET(pager), 0, NULL, 0, 0);
 
   GTK_WIDGET_SET_FLAGS (GTK_WIDGET (pager), GTK_CAN_FOCUS);
 }
@@ -183,7 +196,9 @@
   widget_class->button_release_event = wnck_pager_button_release;
   widget_class->motion_notify_event = wnck_pager_motion;
   widget_class->focus = wnck_pager_focus;
-  widget_class->get_accessible = wnck_pager_get_accessible;   
+  widget_class->get_accessible = wnck_pager_get_accessible;
+  widget_class->drag_leave = wnck_pager_drag_motion_leave;
+  widget_class->drag_motion = wnck_pager_drag_motion;	
 }
 
 static void
@@ -1090,6 +1105,52 @@
   return handled;
 }
 
+static gboolean 
+wnck_pager_drag_motion (GtkWidget          *widget,
+                        GdkDragContext     *context,
+                        gint                x,
+                        gint                y,
+                        guint               time)
+{
+  WnckPager *pager;
+  gboolean handled = FALSE;
+  int space_number;
+  WnckWorkspace *space = NULL;
+
+  pager = WNCK_PAGER (widget);
+  if (pager->priv->dnd_activate == 0 )
+      pager->priv->dnd_activate = g_timeout_add (TIMEOUT_ACTIVATE,
+                                              wnck_pager_drag_motion_timeout,
+                                              pager);
+
+  space_number = workspace_at_point (pager, x, y, NULL, NULL);
+
+  if (space_number != -1)
+    {
+      handled = TRUE;
+      space = wnck_screen_get_workspace (pager->priv->screen, space_number);
+      pager->priv->dnd_workspace = space;
+    }
+ 
+  gdk_drag_status (context,0,time);
+
+  return handled;
+}
+ 
+static gboolean
+wnck_pager_drag_motion_timeout (gpointer data)
+{
+  WnckPager *pager = WNCK_PAGER (data);
+ 
+  pager->priv->dnd_activate = 0;
+
+  if (wnck_workspace_get_number (wnck_screen_get_active_workspace ( pager->priv->screen))
+	  !=  wnck_workspace_get_number(pager->priv->dnd_workspace))
+    wnck_workspace_activate (pager->priv->dnd_workspace);
+
+  return FALSE;
+}
+
 static gboolean
 wnck_pager_motion (GtkWidget        *widget,
                    GdkEventMotion   *event)
@@ -1596,6 +1657,23 @@
   g_signal_connect_object (G_OBJECT (window), "geometry_changed",
                            G_CALLBACK (window_geometry_changed_callback),
                            pager, 0);
+}
+
+static void
+wnck_pager_drag_motion_leave (GtkWidget          *widget,
+                              GdkDragContext     *context,
+                              guint               time)
+{
+  WnckPager *pager;
+
+  pager = WNCK_PAGER (widget);
+
+  if (pager->priv->dnd_activate != 0)
+    {
+      g_source_remove (pager->priv->dnd_activate);
+      pager->priv->dnd_workspace = NULL;
+      pager->priv->dnd_activate = 0;
+    }
 }
 
 static void
