Index: libwnck/pager.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/pager.c,v
retrieving revision 1.35
diff -u -r1.35 pager.c
--- libwnck/pager.c	22 Oct 2003 00:04:24 -0000	1.35
+++ libwnck/pager.c	28 Oct 2003 16:50:05 -0000
@@ -1152,14 +1152,30 @@
 
 	  if (space)
             {
-              wnck_workspace_activate (space);
+              int screen_width, screen_height;
+
+              /* Don't switch the desktop if we're already there */
+              if (space != wnck_screen_get_active_workspace (pager->priv->screen))
+                wnck_workspace_activate (space);
 
               /* EWMH only lets us move the viewport for the active workspace,
                * but we just go ahead and hackily assume that the activate
                * just above takes effect prior to moving the viewport
                */
-              wnck_screen_move_viewport (pager->priv->screen,
-                                         viewport_x, viewport_y);
+
+              /* Transform the pointer location to viewport origin, assuming
+               * that we want the nearest "regular" viewport containing the
+               * pointer.
+               */
+              screen_width = wnck_screen_get_width (pager->priv->screen);
+              screen_height = wnck_screen_get_height (pager->priv->screen);
+              viewport_x = (viewport_x / screen_width) * screen_width;
+              viewport_y = (viewport_y / screen_height) * screen_height;
+              
+              if (wnck_workspace_get_viewport_x(space) != viewport_x ||
+                  wnck_workspace_get_viewport_y(space) != viewport_y)
+                wnck_screen_move_viewport (pager->priv->screen,
+                                           viewport_x, viewport_y);
               
               if (pager->priv->drag_window)
                 wnck_window_activate (pager->priv->drag_window);
