diff -Nur metacity-2.14.1/src/window.c metacity-2.14.1.new/src/window.c
--- metacity-2.14.1/src/window.c	2006-03-22 14:03:23.771399800 +0000
+++ metacity-2.14.1.new/src/window.c	2006-03-22 14:16:23.574851656 +0000
@@ -5387,6 +5387,7 @@
 update_transient_for (MetaWindow *window)
 {
   Window w;
+  MetaWindow *mw;
 
   meta_error_trap_push (window->display);
   w = None;
@@ -5395,7 +5396,25 @@
                         &w);
   meta_error_trap_pop (window->display, TRUE);
   window->xtransient_for = w;
-
+  
+  /* If the transient parent is not a toplevel window, trace up the stack
+   * until we find it (or hit the root window)
+   */
+  while ((meta_display_lookup_x_window (window->display, window->xtransient_for) == NULL) && (window->xtransient_for != window->screen->xroot))
+    {
+      Window root_return, parent_return, *children_return;
+      unsigned int nchildren_return;
+      if (XQueryTree (window->display->xdisplay, window->xtransient_for,
+                      &root_return, &parent_return, &children_return,
+                      &nchildren_return) == 0)
+        break;
+      else
+        {
+          XFree(children_return);
+          window->xtransient_for = parent_return;
+        }
+    }
+  
   window->transient_parent_is_root_window =
     window->xtransient_for == window->screen->xroot;
   
