Index: gdk/gdkwindow.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkwindow.h,v
retrieving revision 1.46
diff -p -u -r1.46 gdkwindow.h
--- gdk/gdkwindow.h	10 Aug 2003 23:37:29 -0000	1.46
+++ gdk/gdkwindow.h	7 Dec 2003 19:52:39 -0000
@@ -400,10 +400,12 @@ void	      gdk_window_set_hints	 (GdkWin
 					  gint		   max_height,
 					  gint		   flags);
 #endif
-void          gdk_window_set_type_hint    (GdkWindow       *window,
-					   GdkWindowTypeHint hint);
-void          gdk_window_set_modal_hint   (GdkWindow       *window,
-                                           gboolean         modal);
+void          gdk_window_set_type_hint      (GdkWindow       *window,
+					     GdkWindowTypeHint hint);
+void          gdk_window_set_modal_hint     (GdkWindow       *window,
+                                             gboolean         modal);
+void          gdk_window_set_user_time_hint (GdkWindow       *window,
+                                             guint32         timestamp);
 
 void gdk_window_set_skip_taskbar_hint (GdkWindow *window,
                                        gboolean   skips_taskbar);
Index: gdk/x11/gdkevents-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkevents-x11.c,v
retrieving revision 1.118
diff -p -u -r1.118 gdkevents-x11.c
--- gdk/x11/gdkevents-x11.c	11 Aug 2003 16:08:27 -0000	1.118
+++ gdk/x11/gdkevents-x11.c	7 Dec 2003 19:52:45 -0000
@@ -769,6 +769,20 @@ static const char notify_details[][22] =
 };
 #endif
 
+/* update the _NET_WM_USER_TIME property on the window for an event
+*/
+void
+set_user_time (GdkWindow* window, GdkEvent *event)
+{
+  g_return_if_fail (event != NULL);
+
+  window = gdk_window_get_toplevel (event->client.window);
+  g_return_if_fail (GDK_IS_WINDOW (window));
+
+  gdk_window_set_user_time_hint (gdk_window_get_toplevel (window),
+				 gdk_event_get_time (event));
+}
+
 static gboolean
 gdk_event_translate (GdkDisplay *display,
 		     GdkEvent   *event,
@@ -962,6 +976,7 @@ gdk_event_translate (GdkDisplay *display
           break;
         }
       translate_key_event (display, event, xevent);
+      set_user_time (window, event);
       break;
 
     case KeyRelease:
@@ -1060,6 +1075,7 @@ gdk_event_translate (GdkDisplay *display
           break;
 	}
 
+      set_user_time (window, event);
       break;
       
     case ButtonRelease:
Index: gdk/x11/gdkwindow-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkwindow-x11.c,v
retrieving revision 1.195
diff -p -u -r1.195 gdkwindow-x11.c
--- gdk/x11/gdkwindow-x11.c	23 Oct 2003 18:50:40 -0000	1.195
+++ gdk/x11/gdkwindow-x11.c	7 Dec 2003 19:52:53 -0000
@@ -1882,6 +1882,45 @@ gdk_window_set_modal_hint (GdkWindow *wi
 }
 
 /**
+ * gdk_window_user_time_hint:
+ * @window: A toplevel #GdkWindow
+ * @timestamp: An XServer timestamp to which the property should be set
+ *
+ * The application can use this call to update the _NET_WM_USER_TIME
+ * property on a toplevel window.  This property stores an Xserver
+ * time which represents the time of the last user input event
+ * received for this window.  This property may be used by the window
+ * manager to alter the focus, stacking, and/or placement behavior of
+ * windows when they are mapped depending on whether the new window
+ * was created by a user action or is a "pop-up" window activated by a
+ * timer or some other event.
+ *
+ * Note that this property is automatically updated by GDK, so this
+ * function should only be used by applications which handle input
+ * events bypassing GDK.
+ * 
+ * Since: 2.4
+ **/
+void
+gdk_window_set_user_time_hint (GdkWindow        *window,
+			       guint32           timestamp) {
+  GdkDisplay *display;
+  
+  g_return_if_fail (window != NULL);
+  g_return_if_fail (GDK_IS_WINDOW (window));
+  
+  if (GDK_WINDOW_DESTROYED (window))
+    return;
+
+  display = gdk_drawable_get_display (window);
+
+  XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
+                   gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_USER_TIME"),
+                   XA_CARDINAL, 32, PropModeReplace,
+                   (guchar *)&timestamp, 1);
+}
+
+/**
  * gdk_window_set_skip_taskbar_hint:
  * @window: a toplevel #GdkWindow
  * @skips_taskbar: %TRUE to skip the taskbar
