Index: libwnck/selector.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/selector.c,v
retrieving revision 1.3
diff -p -u -r1.3 selector.c
--- libwnck/selector.c	2 Feb 2005 09:12:51 -0000	1.3
+++ libwnck/selector.c	11 Feb 2005 18:14:21 -0000
@@ -219,7 +219,7 @@ wnck_selector_get_window_name (WnckWindo
   else
     name = g_strdup (const_name);
 
-  if (wnck_window_demands_attention (window))
+  if (wnck_window_or_transient_demands_attention (window))
     {
       return_value = g_strdup_printf ("<b>%s</b>", name);
       g_free (name);
Index: libwnck/tasklist.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/tasklist.c,v
retrieving revision 1.73
diff -p -u -r1.73 tasklist.c
--- libwnck/tasklist.c	28 Jan 2005 16:53:45 -0000	1.73
+++ libwnck/tasklist.c	11 Feb 2005 18:14:21 -0000
@@ -2376,7 +2376,7 @@ wnck_task_get_demands_attention (WnckTas
 	{
 	  win_task = WNCK_TASK (l->data);
 
-	  if (wnck_window_get_state (win_task->window) & WNCK_WINDOW_STATE_DEMANDS_ATTENTION)
+	  if (wnck_window_or_transient_demands_attention (win_task->window))
 	    {
 	      demands_attention = TRUE;
 	      break;
@@ -2388,7 +2388,7 @@ wnck_task_get_demands_attention (WnckTas
 
     case WNCK_TASK_WINDOW:
       demands_attention =
-	wnck_window_get_state (task->window) & WNCK_WINDOW_STATE_DEMANDS_ATTENTION;
+	wnck_window_or_transient_demands_attention (task->window);
       break;
 
     case WNCK_TASK_STARTUP_SEQUENCE:
Index: libwnck/window.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/window.c,v
retrieving revision 1.51
diff -p -u -r1.51 window.c
--- libwnck/window.c	11 Feb 2005 09:53:47 -0000	1.51
+++ libwnck/window.c	11 Feb 2005 18:14:21 -0000
@@ -166,6 +166,9 @@ static void unqueue_update   (WnckWindow
 static void queue_update     (WnckWindow *window);
 static void force_update_now (WnckWindow *window);
 
+static WnckWindow* find_last_transient_for (GList *windows,
+                                            Window xwindow);
+
 static gpointer parent_class;
 static guint signals[LAST_SIGNAL] = { 0 };
 
@@ -610,11 +613,11 @@ wnck_window_is_minimized (WnckWindow *wi
  * wnck_window_demands_attention:
  * @window: a #WnckWindow
  *
- * If the window is has the demands attention state set returns
+ * If the window has the demands attention state set returns
  * %TRUE. This state may change anytime a state_changed signal gets
  * emitted.
  *
- * Return value: %TRUE if window is minimized
+ * Return value: %TRUE if window has the demands_attention hint set
  **/
 gboolean
 wnck_window_demands_attention (WnckWindow *window)
@@ -624,6 +627,49 @@ wnck_window_demands_attention (WnckWindo
   return window->priv->demands_attention;
 }
 
+/* Return whether one of the transients of @window demands attention */
+static gboolean
+transient_demands_attention (WnckWindow *window)
+{
+  GList *windows;
+  WnckWindow *transient;
+  
+  if (!WNCK_IS_WINDOW (window))
+    return FALSE;
+
+  windows = wnck_screen_get_windows_stacked (window->priv->screen);
+
+  transient = window;
+  while ((transient = find_last_transient_for (windows, transient->priv->xwindow)))
+    {
+      /* catch transient cycles */
+      if (transient == window)
+        return FALSE;
+
+      if (wnck_window_demands_attention (transient))
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+/**
+ * wnck_window_or_transient_demands_attention:
+ * @window: a #WnckWindow
+ *
+ * If the window or one of its transients has the demands attention
+ * state set returns %TRUE. This state may change anytime a
+ * state_changed signal gets emitted.
+ *
+ * Return value: %TRUE if window or one of its transients has the
+ *               demands_attention hint set
+ **/
+gboolean
+wnck_window_or_transient_demands_attention (WnckWindow *window)
+{
+  return wnck_window_demands_attention (window) || 
+         transient_demands_attention (window);
+}
 
 gboolean
 wnck_window_is_maximized_horizontally (WnckWindow *window)
@@ -1102,7 +1148,6 @@ wnck_window_is_most_recently_activated (
   return (window == most_recently_activated_window);
 }
 
-
 static WnckWindow*
 find_last_transient_for (GList *windows,
                          Window xwindow)
@@ -1186,7 +1231,7 @@ wnck_window_activate_transient (WnckWind
  * wnck_window_transient_is_active:
  * @window: a #WnckWindow
  *
- * Return whether @window or one of its transients has focus.  This
+ * Return whether one of the transients of @window has focus.  This
  * function is needed because clicking on the tasklist once will
  * activate a transient instead of the window itself
  * (wnck_window_activate_transient), and clicking again should
Index: libwnck/window.h
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/window.h,v
retrieving revision 1.29
diff -p -u -r1.29 window.h
--- libwnck/window.h	22 Jan 2005 21:06:19 -0000	1.29
+++ libwnck/window.h	11 Feb 2005 18:14:21 -0000
@@ -155,9 +155,10 @@ gboolean wnck_window_is_maximized       
 gboolean wnck_window_is_shaded                 (WnckWindow *window);
 gboolean wnck_window_is_skip_pager             (WnckWindow *window);
 gboolean wnck_window_is_skip_tasklist          (WnckWindow *window);
-gboolean wnck_window_is_fullscreen                 (WnckWindow *window);
+gboolean wnck_window_is_fullscreen             (WnckWindow *window);
 gboolean wnck_window_is_sticky                 (WnckWindow *window);
 gboolean wnck_window_demands_attention         (WnckWindow *window);
+gboolean wnck_window_or_transient_demands_attention (WnckWindow *window);
 
 void wnck_window_set_skip_pager    (WnckWindow *window,
                                     gboolean skip);
