Index: src/window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.404
diff -p -u -r1.404 window.c
--- src/window.c	2 Jan 2006 18:48:30 -0000	1.404
+++ src/window.c	7 Jan 2006 01:40:52 -0000
@@ -1675,6 +1675,40 @@ intervening_user_event_occurred (MetaWin
     }
 }
 
+static gboolean
+window_is_terminal (MetaWindow *window)
+{
+  if (window == NULL)
+    return FALSE;
+
+  /* gnome-terminal -- if you couldn't guess */
+  if (strcmp (window->res_name, "gnome-terminal") == 0)
+    return TRUE;
+  /* xterm, rxvt, aterm */
+  else if (strcmp (window->res_name, "XTerm") == 0)
+    return TRUE;
+  /* konsole, KDE's terminal program */
+  else if (strcmp (window->res_name, "Konsole") == 0)
+    return TRUE;
+  /* rxvt-unicode */
+  else if (strcmp (window->res_name, "URxvt") == 0)
+    return TRUE;
+  /* eterm */
+  else if (strcmp (window->res_name, "Eterm") == 0)
+    return TRUE;
+  /* KTerm -- some terminal not KDE based; so not like Konsole */
+  else if (strcmp (window->res_name, "KTerm") == 0)
+    return TRUE;
+  /* Multi-gnome-terminal */
+  else if (strcmp (window->res_name, "Multi-gnome-terminal") == 0)
+    return TRUE;
+  /* mlterm ("multi lingual terminal emulator on X") */
+  else if (strcmp (window->res_name, "mlterm") == 0)
+    return TRUE;
+
+  return FALSE;
+}
+
 /* This function determines what state the window should have assuming that it
  * and the focus_window have no relation
  */
@@ -1697,6 +1731,22 @@ window_state_on_map (MetaWindow *window,
     {
       *takes_focus = FALSE;
       return;
+    }
+
+  /* Terminal usage is different; users typically intend to launch
+   * many apps in quick succession or to just view things in the new
+   * window while still interacting with the terminal.  Therefore,
+   * apps launched from the terminal should not take focus.  This
+   * isn't quite the same as not allowing focus to transfer from
+   * terminals due to new window map, but the latter is a much easier
+   * approximation to enforce so we do that.
+   */
+  if (*takes_focus && window_is_terminal (window->display->focus_window))
+    {
+      meta_topic (META_DEBUG_FOCUS,
+                  "focus_window is terminal; not focusing new window.\n");
+      *takes_focus = FALSE;
+      *places_on_top = FALSE;
     }
 
   switch (window->type)
