Index: src/bell.c
===================================================================
RCS file: /cvs/gnome/metacity/src/bell.c,v
retrieving revision 1.4
diff -p -u -r1.4 bell.c
--- src/bell.c	25 Feb 2005 20:14:07 -0000	1.4
+++ src/bell.c	2 Oct 2005 03:36:21 -0000
@@ -131,6 +131,23 @@ meta_bell_flash_window_frame (MetaWindow
       meta_bell_unflash_frame, window->frame, NULL);
 }
 
+gboolean
+meta_bell_flash_window_frame_multiple (MetaWindow *window)
+{
+  g_assert (window->frame != NULL);
+  window->frame->is_flashing = 
+    (window->is_urgent ? !window->frame->is_flashing : 0);
+  meta_frame_queue_draw (window->frame);
+
+  if (!window->is_urgent)
+    {
+      window->flash_timer = 0;
+      return FALSE;
+    }
+
+  return TRUE;
+}
+  
 static void
 meta_bell_flash_frame (MetaDisplay *display, 
 		       XkbAnyEvent *xkb_ev)
Index: src/bell.h
===================================================================
RCS file: /cvs/gnome/metacity/src/bell.h,v
retrieving revision 1.2
diff -p -u -r1.2 bell.h
--- src/bell.h	29 Apr 2003 22:07:47 -0000	1.2
+++ src/bell.h	2 Oct 2005 03:36:21 -0000
@@ -33,3 +33,4 @@ void meta_bell_set_audible (MetaDisplay 
 gboolean meta_bell_init (MetaDisplay *display);
 void meta_bell_shutdown (MetaDisplay *display);
 void meta_bell_notify_frame_destroy (MetaFrame *frame);
+gboolean meta_bell_flash_window_frame_multiple (MetaWindow *window);
Index: src/window-props.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window-props.c,v
retrieving revision 1.19
diff -p -u -r1.19 window-props.c
--- src/window-props.c	20 Feb 2005 17:14:16 -0000	1.19
+++ src/window-props.c	2 Oct 2005 03:36:22 -0000
@@ -23,6 +23,7 @@
 #include "window-props.h"
 #include "xprops.h"
 #include "frame.h"
+#include "bell.h"
 #include "group.h"
 #include <X11/Xatom.h>
 
@@ -779,12 +780,15 @@ reload_wm_hints (MetaWindow    *window,
                  MetaPropValue *value)
 {
   Window old_group_leader;
+  guint old_is_urgent;
   
   old_group_leader = window->xgroup_leader;
-  
+  old_is_urgent = window->is_urgent;
+
   /* Fill in defaults */
   window->input = TRUE;
   window->initially_iconic = FALSE;
+  window->is_urgent = FALSE;
   window->xgroup_leader = None;
   window->wm_hints_pixmap = None;
   window->wm_hints_mask = None;
@@ -808,11 +812,15 @@ reload_wm_hints (MetaWindow    *window,
       if (hints->flags & IconMaskHint)
         window->wm_hints_mask = hints->icon_mask;
       
-      meta_verbose ("Read WM_HINTS input: %d iconic: %d group leader: 0x%lx pixmap: 0x%lx mask: 0x%lx\n",
+      if (hints->flags & XUrgencyHint)
+        window->is_urgent = TRUE;
+     
+      meta_verbose ("Read WM_HINTS input: %d iconic: %d group leader: 0x%lx pixmap: 0x%lx mask: 0x%lx urgent: %d\n",
                     window->input, window->initially_iconic,
                     window->xgroup_leader,
                     window->wm_hints_pixmap,
-                    window->wm_hints_mask);
+                    window->wm_hints_mask,
+                    window->is_urgent);
     }
 
   if (window->xgroup_leader != old_group_leader)
@@ -821,6 +829,23 @@ reload_wm_hints (MetaWindow    *window,
                     window->desc, window->xgroup_leader);
       
       meta_window_group_leader_changed (window);
+    }
+
+  if ((window->is_urgent != old_is_urgent) && (window->frame))
+    {
+      meta_verbose ("Window %s changes its urgent'ness to %u\n",
+                    window->desc, window->is_urgent);
+
+      if (window->is_urgent)
+        window->flash_timer = 
+          g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 1000,
+                              meta_bell_flash_window_frame_multiple,
+                              window, NULL);
+      else
+        {
+          window->frame->is_flashing = 0;
+          meta_frame_queue_draw (window->frame);
+        }
     }
 
   meta_icon_cache_property_changed (&window->icon_cache,
Index: src/window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.392
diff -p -u -r1.392 window.c
--- src/window.c	3 Aug 2005 02:22:00 -0000	1.392
+++ src/window.c	2 Oct 2005 03:36:22 -0000
@@ -363,6 +363,8 @@ meta_window_new_with_attrs (MetaDisplay 
   window->display = display;
   window->workspace = NULL;
 
+  window->flash_timer = 0;
+
 #ifdef HAVE_XSYNC
   window->sync_request_counter = None;
   window->sync_request_serial = 0;
@@ -987,6 +989,9 @@ meta_window_free (MetaWindow  *window)
   
   meta_stack_remove (window->screen->stack, window);
   
+  if (window->flash_timer)
+    g_source_remove (window->flash_timer);
+
   if (window->frame)
     meta_window_destroy_frame (window);
   
Index: src/window.h
===================================================================
RCS file: /cvs/gnome/metacity/src/window.h,v
retrieving revision 1.116
diff -p -u -r1.116 window.h
--- src/window.h	26 May 2005 19:58:17 -0000	1.116
+++ src/window.h	2 Oct 2005 03:36:22 -0000
@@ -262,6 +262,12 @@ struct _MetaWindow
   /* if TRUE we have a grab on the focus click buttons */
   guint have_focus_click_grab : 1;
 
+  /* window is marked urgent */
+  guint is_urgent : 1;
+
+  /* window flash timer */
+  guint flash_timer;
+
   /* if TRUE, application is buggy and SYNC resizing is turned off */
   guint disable_sync : 1;
 
