Index: libwnck/pager.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/pager.c,v
retrieving revision 1.38
diff -p -u -r1.38 pager.c
--- libwnck/pager.c	26 Jun 2004 03:06:32 -0000	1.38
+++ libwnck/pager.c	9 Aug 2004 21:39:36 -0000
@@ -1135,7 +1135,7 @@ wnck_pager_button_release (GtkWidget    
               wnck_window_move_to_workspace (pager->priv->drag_window,
                                              space);
               if (space == wnck_screen_get_active_workspace (pager->priv->screen))
-                wnck_window_activate (pager->priv->drag_window);
+                wnck_window_activate (pager->priv->drag_window, event->time);
             }	  
 	}
       
@@ -1178,7 +1178,7 @@ wnck_pager_button_release (GtkWidget    
              */
 	    if ((space == wnck_screen_get_active_workspace (pager->priv->screen))
                 && (pager->priv->drag_window))
-	      wnck_window_activate (pager->priv->drag_window);
+	      wnck_window_activate (pager->priv->drag_window, event->time);
 	  }
       
       if (pager->priv->drag_window)
Index: libwnck/tasklist.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/tasklist.c,v
retrieving revision 1.58
diff -p -u -r1.58 tasklist.c
--- libwnck/tasklist.c	25 Jul 2004 18:04:21 -0000	1.58
+++ libwnck/tasklist.c	9 Aug 2004 21:39:39 -0000
@@ -1829,7 +1829,7 @@ wnck_task_menu_activated (GtkMenuItem *m
 }
 
 static void
-wnck_tasklist_activate_task_window     (WnckTask *task)
+wnck_tasklist_activate_task_window (WnckTask *task)
 {
   WnckTasklist *tasklist;
   WnckWindowState state;
@@ -1853,7 +1853,8 @@ wnck_tasklist_activate_task_window     (
 	  !tasklist->priv->switch_workspace_on_unminimize)
 	wnck_workspace_activate (window_ws);
 	  
-      wnck_window_activate_transient (task->window);
+      wnck_window_activate_transient (task->window,
+                                      gtk_get_current_event_time ());
     }
   else
     {
@@ -1871,7 +1872,8 @@ wnck_tasklist_activate_task_window     (
           if (window_ws)
             wnck_workspace_activate (window_ws);
 
-	  wnck_window_activate_transient (task->window);
+	  wnck_window_activate_transient (task->window,
+                                          gtk_get_current_event_time ());
 	}
     }
   
@@ -2292,7 +2294,8 @@ wnck_task_motion_timeout (gpointer data)
 
   task->button_activate = 0;
 
-  wnck_window_activate_transient (task->window);
+  wnck_window_activate_transient (task->window,
+                                  gtk_get_current_event_time ());
 
   return FALSE;
 }
Index: libwnck/test-wnck.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/test-wnck.c,v
retrieving revision 1.12
diff -p -u -r1.12 test-wnck.c
--- libwnck/test-wnck.c	25 Sep 2002 02:36:53 -0000	1.12
+++ libwnck/test-wnck.c	9 Aug 2004 21:39:40 -0000
@@ -716,7 +716,8 @@ selection_func (GtkTreeSelection  *selec
         return TRUE;
       else
         {
-          wnck_window_activate (window);
+          /* FIXME: wnck_window_activate needs a real timestamp, not 0. */
+          wnck_window_activate (window, 0);
           return FALSE;
         }
     }
Index: libwnck/window.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/window.c,v
retrieving revision 1.45
diff -p -u -r1.45 window.c
--- libwnck/window.c	8 Aug 2004 00:01:44 -0000	1.45
+++ libwnck/window.c	9 Aug 2004 21:39:42 -0000
@@ -1020,17 +1020,19 @@ wnck_window_unpin (WnckWindow *window)
 /**
  * wnck_window_activate:
  * @window: a #WnckWindow
+ * @timestamp: an X server timestamp
  *
  * Ask the window manager to make @window the active window.  The
  * window manager may choose to raise @window along with focusing it.
  **/
 void
-wnck_window_activate (WnckWindow *window)
+wnck_window_activate (WnckWindow *window, guint32 timestamp)
 {
   g_return_if_fail (WNCK_IS_WINDOW (window));
 
   _wnck_activate (WNCK_SCREEN_XSCREEN (window->priv->screen),
-		  window->priv->xwindow);
+		  window->priv->xwindow,
+		  (Time) timestamp);
 }
 
 /**
@@ -1079,6 +1081,7 @@ find_last_transient_for (GList *windows,
 /**
  * wnck_window_activate_transient:
  * @window: a #WnckWindow
+ * @timestamp: an X server timestamp
  *
  * If @window has transients, activates the most likely transient
  * instead of the window itself. Otherwise activates @window.
@@ -1089,7 +1092,7 @@ find_last_transient_for (GList *windows,
  * 
  **/
 void
-wnck_window_activate_transient (WnckWindow *window)
+wnck_window_activate_transient (WnckWindow *window, guint32 timestamp)
 {
   GList *windows;
   WnckWindow *transient;
@@ -1121,11 +1124,11 @@ wnck_window_activate_transient (WnckWind
       /* Raise but don't focus the main window */
       XRaiseWindow (gdk_display, window->priv->xwindow);
       /* then activate the transient */
-      wnck_window_activate (transient);
+      wnck_window_activate (transient, timestamp);
     }
   else
     {
-      wnck_window_activate (window);
+      wnck_window_activate (window, timestamp);
     }
 }
 
Index: libwnck/window.h
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/window.h,v
retrieving revision 1.24
diff -p -u -r1.24 window.h
--- libwnck/window.h	25 Jul 2004 18:04:22 -0000	1.24
+++ libwnck/window.h	9 Aug 2004 21:39:42 -0000
@@ -187,9 +187,11 @@ gboolean wnck_window_is_pinned (WnckWind
 void     wnck_window_pin       (WnckWindow *window);
 void     wnck_window_unpin     (WnckWindow *window);
 
-void     wnck_window_activate  (WnckWindow *window);
+void     wnck_window_activate  (WnckWindow *window,
+                                guint32     timestamp);
 gboolean wnck_window_is_active (WnckWindow *window);
-void     wnck_window_activate_transient (WnckWindow *window);
+void     wnck_window_activate_transient (WnckWindow *window,
+                                         guint32     timestamp);
 
 
 GdkPixbuf* wnck_window_get_icon      (WnckWindow *window);
Index: libwnck/xutils.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/xutils.c,v
retrieving revision 1.46
diff -p -u -r1.46 xutils.c
--- libwnck/xutils.c	8 Aug 2004 00:01:44 -0000	1.46
+++ libwnck/xutils.c	9 Aug 2004 21:39:44 -0000
@@ -835,15 +835,14 @@ _wnck_close (Screen *screen,
   XEvent xev;
   
   xev.xclient.type = ClientMessage;
-  xev.xclient.serial = 0;
-  xev.xclient.send_event = True;
-  xev.xclient.display = gdk_display;
   xev.xclient.window = xwindow;
   xev.xclient.message_type = _wnck_atom_get ("_NET_CLOSE_WINDOW");
   xev.xclient.format = 32;
   xev.xclient.data.l[0] = timestamp;
   xev.xclient.data.l[1] = 0;
   xev.xclient.data.l[2] = 0;
+  xev.xclient.data.l[3] = 0;
+  xev.xclient.data.l[4] = 0;
 
   XSendEvent (gdk_display,
               RootWindowOfScreen (screen),
@@ -871,9 +870,6 @@ _wnck_keyboard_move (Screen *screen,
   XEvent xev;
   
   xev.xclient.type = ClientMessage;
-  xev.xclient.serial = 0;
-  xev.xclient.send_event = True;
-  xev.xclient.display = gdk_display;
   xev.xclient.window = xwindow;
   xev.xclient.message_type = _wnck_atom_get ("_NET_WM_MOVERESIZE");
   xev.xclient.format = 32;
@@ -881,6 +877,7 @@ _wnck_keyboard_move (Screen *screen,
   xev.xclient.data.l[1] = 0; /* unused */
   xev.xclient.data.l[2] = _NET_WM_MOVERESIZE_MOVE_KEYBOARD;
   xev.xclient.data.l[3] = 0; /* unused */
+  xev.xclient.data.l[4] = 0;
 
   XSendEvent (gdk_display,
               RootWindowOfScreen (screen),
@@ -896,9 +893,6 @@ _wnck_keyboard_size (Screen *screen,
   XEvent xev;
   
   xev.xclient.type = ClientMessage;
-  xev.xclient.serial = 0;
-  xev.xclient.send_event = True;
-  xev.xclient.display = gdk_display;
   xev.xclient.window = xwindow;
   xev.xclient.message_type = _wnck_atom_get ("_NET_WM_MOVERESIZE");
   xev.xclient.format = 32;
@@ -906,6 +900,7 @@ _wnck_keyboard_size (Screen *screen,
   xev.xclient.data.l[1] = 0; /* unused */
   xev.xclient.data.l[2] = _NET_WM_MOVERESIZE_SIZE_KEYBOARD;
   xev.xclient.data.l[3] = 0; /* unused */
+  xev.xclient.data.l[4] = 0;
 
   XSendEvent (gdk_display,
               RootWindowOfScreen (screen),
@@ -928,15 +923,14 @@ _wnck_change_state (Screen  *screen,
 #define _NET_WM_STATE_TOGGLE        2    /* toggle property  */  
   
   xev.xclient.type = ClientMessage;
-  xev.xclient.serial = 0;
-  xev.xclient.send_event = True;
-  xev.xclient.display = gdk_display;
   xev.xclient.window = xwindow;
   xev.xclient.message_type = _wnck_atom_get ("_NET_WM_STATE");
   xev.xclient.format = 32;
   xev.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
   xev.xclient.data.l[1] = state1;
   xev.xclient.data.l[2] = state2;
+  xev.xclient.data.l[3] = 0;
+  xev.xclient.data.l[4] = 0;
 
   XSendEvent (gdk_display,
 	      RootWindowOfScreen (screen),
@@ -953,15 +947,14 @@ _wnck_change_workspace (Screen     *scre
   XEvent xev;
   
   xev.xclient.type = ClientMessage;
-  xev.xclient.serial = 0;
-  xev.xclient.send_event = True;
-  xev.xclient.display = gdk_display;
   xev.xclient.window = xwindow;
   xev.xclient.message_type = _wnck_atom_get ("_NET_WM_DESKTOP");
   xev.xclient.format = 32;
   xev.xclient.data.l[0] = new_space;
   xev.xclient.data.l[1] = 0;
   xev.xclient.data.l[2] = 0;
+  xev.xclient.data.l[3] = 0;
+  xev.xclient.data.l[4] = 0;
 
   XSendEvent (gdk_display,
 	      RootWindowOfScreen (screen),
@@ -972,7 +965,8 @@ _wnck_change_workspace (Screen     *scre
 
 void
 _wnck_activate (Screen *screen,
-		Window  xwindow)
+		Window  xwindow,
+		Time    timestamp)
 {
   XEvent xev;
 
@@ -984,15 +978,14 @@ _wnck_activate (Screen *screen,
                "function properly.\n");
   
   xev.xclient.type = ClientMessage;
-  xev.xclient.serial = 0;
-  xev.xclient.send_event = True;
-  xev.xclient.display = gdk_display;
   xev.xclient.window = xwindow;
   xev.xclient.message_type = _wnck_atom_get ("_NET_ACTIVE_WINDOW");
   xev.xclient.format = 32;
-  xev.xclient.data.l[0] = 2;
+  xev.xclient.data.l[0] = 2; /* source indication; we're a pager */
   xev.xclient.data.l[1] = timestamp;
   xev.xclient.data.l[2] = 0;
+  xev.xclient.data.l[3] = 0;
+  xev.xclient.data.l[4] = 0;
 
   XSendEvent (gdk_display,
 	      RootWindowOfScreen (screen),
@@ -1008,15 +1001,14 @@ _wnck_activate_workspace (Screen *screen
   XEvent xev;
   
   xev.xclient.type = ClientMessage;
-  xev.xclient.serial = 0;
-  xev.xclient.send_event = True;
-  xev.xclient.display = gdk_display;
   xev.xclient.window = RootWindowOfScreen (screen);
   xev.xclient.message_type = _wnck_atom_get ("_NET_CURRENT_DESKTOP");
   xev.xclient.format = 32;
   xev.xclient.data.l[0] = new_active_space;
   xev.xclient.data.l[1] = 0;
   xev.xclient.data.l[2] = 0;
+  xev.xclient.data.l[3] = 0;
+  xev.xclient.data.l[4] = 0;
 
   XSendEvent (gdk_display,
 	      RootWindowOfScreen (screen),
@@ -1033,15 +1025,14 @@ _wnck_change_viewport (Screen *screen,
   XEvent xev;
   
   xev.xclient.type = ClientMessage;
-  xev.xclient.serial = 0;
-  xev.xclient.send_event = True;
-  xev.xclient.display = gdk_display;
   xev.xclient.window = RootWindowOfScreen (screen);
   xev.xclient.message_type = _wnck_atom_get ("_NET_DESKTOP_VIEWPORT");
   xev.xclient.format = 32;
   xev.xclient.data.l[0] = x;
   xev.xclient.data.l[1] = y;
   xev.xclient.data.l[2] = 0;
+  xev.xclient.data.l[3] = 0;
+  xev.xclient.data.l[4] = 0;
 
   XSendEvent (gdk_display,
 	      RootWindowOfScreen (screen),
@@ -1057,15 +1048,14 @@ _wnck_toggle_showing_desktop (Screen  *s
   XEvent xev;
   
   xev.xclient.type = ClientMessage;
-  xev.xclient.serial = 0;
-  xev.xclient.send_event = True;
-  xev.xclient.display = DisplayOfScreen (screen);
   xev.xclient.window = RootWindowOfScreen (screen);
   xev.xclient.message_type = _wnck_atom_get ("_NET_SHOWING_DESKTOP");
   xev.xclient.format = 32;
   xev.xclient.data.l[0] = show != FALSE;
   xev.xclient.data.l[1] = 0;
   xev.xclient.data.l[2] = 0;
+  xev.xclient.data.l[3] = 0;
+  xev.xclient.data.l[4] = 0;
 
   XSendEvent (DisplayOfScreen (screen),
 	      RootWindowOfScreen (screen),
Index: libwnck/xutils.h
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/xutils.h,v
retrieving revision 1.24
diff -p -u -r1.24 xutils.h
--- libwnck/xutils.h	21 Jun 2004 16:48:12 -0000	1.24
+++ libwnck/xutils.h	9 Aug 2004 21:39:45 -0000
@@ -100,7 +100,8 @@ void _wnck_change_workspace (Screen  *sc
 			     Window   xwindow,
                              int      new_space);
 void _wnck_activate         (Screen  *screen,
-			     Window   xwindow);
+			     Window   xwindow,
+			     Time     timestamp);
 void _wnck_activate_workspace (Screen *screen,
 			       int     new_active_space);
 void _wnck_change_viewport (Screen *screen,
