--- metacity-2.13.144/src/prefs.c.configure-terminal-misfeature	2006-02-27 22:39:15.000000000 +0000
+++ metacity-2.13.144/src/prefs.c	2006-03-11 15:04:00.000000000 +0000
@@ -54,6 +54,7 @@
 #define KEY_DISABLE_WORKAROUNDS "/apps/metacity/general/disable_workarounds"
 #define KEY_BUTTON_LAYOUT "/apps/metacity/general/button_layout"
 #define KEY_REDUCED_RESOURCES "/apps/metacity/general/reduced_resources"
+#define KEY_STRICT_FOCUS_APPROXIMATION "/apps/metacity/general/strict_focus_approximation"
 #define KEY_GNOME_ACCESSIBILITY "/desktop/gnome/interface/accessibility"
 
 #define KEY_COMMAND_PREFIX "/apps/metacity/keybinding_commands/command_"
@@ -94,6 +95,7 @@
 static gboolean provide_visual_bell = FALSE;
 static gboolean bell_is_audible = TRUE;
 static gboolean reduced_resources = FALSE;
+static gboolean strict_focus_approximation = FALSE;
 static gboolean gnome_accessibility = FALSE;
 static char *cursor_theme = NULL;
 static int   cursor_size = 24;
@@ -147,6 +149,7 @@
 static gboolean update_workspace_name     (const char  *name,
                                            const char  *value);
 static gboolean update_reduced_resources  (gboolean     value);
+static gboolean update_strict_focus_approximation  (gboolean     value);
 static gboolean update_gnome_accessibility  (gboolean     value);
 static gboolean update_cursor_theme       (const char *value);
 static gboolean update_cursor_size        (int size);
@@ -453,6 +456,9 @@
   if (get_bool (KEY_REDUCED_RESOURCES, &bool_val))
     update_reduced_resources (bool_val);
 
+  if (get_bool (KEY_STRICT_FOCUS_APPROXIMATION, &bool_val))
+    update_strict_focus_approximation (bool_val);
+
   str_val = gconf_client_get_string (default_client, KEY_TERMINAL_COMMAND,
                                      &err);
   cleanup_error (&err);
@@ -905,6 +911,22 @@
       if (update_reduced_resources (b))
         queue_changed (META_PREF_REDUCED_RESOURCES);
     }
+  else if (strcmp (key, KEY_STRICT_FOCUS_APPROXIMATION) == 0)
+    {
+      gboolean b;
+
+      if (value && value->type != GCONF_VALUE_BOOL)
+        {
+          meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
+                        KEY_STRICT_FOCUS_APPROXIMATION);
+          goto out;
+        }
+
+      b = value ? gconf_value_get_bool (value) : strict_focus_approximation;
+
+      if (update_strict_focus_approximation (b))
+        queue_changed (META_PREF_STRICT_FOCUS_APPROXIMATION);
+    }
   else if (strcmp (key, KEY_GNOME_ACCESSIBILITY) == 0)
     {
       gboolean b;
@@ -1551,6 +1573,16 @@
 }
 
 static gboolean
+update_strict_focus_approximation (gboolean value)
+{
+  gboolean old = strict_focus_approximation;
+
+  strict_focus_approximation = value;
+
+  return old != strict_focus_approximation;
+}
+
+static gboolean
 update_gnome_accessibility (gboolean value)
 {
   gboolean old = gnome_accessibility;
@@ -1630,6 +1662,9 @@
     case META_PREF_REDUCED_RESOURCES:
       return "REDUCED_RESOURCES";
 
+    case META_PREF_STRICT_FOCUS_APPROXIMATION:
+      return "STRICT_FOCUS_APPROXIMATION";
+
     case META_PREF_GNOME_ACCESSIBILITY:
       return "GNOME_ACCESSIBILTY";
 
@@ -2510,6 +2545,12 @@
 }
 
 gboolean
+meta_prefs_get_strict_focus_approximation (void)
+{
+  return strict_focus_approximation;
+}
+
+gboolean
 meta_prefs_get_gnome_accessibility ()
 {
   return gnome_accessibility;
--- metacity-2.13.144/src/window.c.configure-terminal-misfeature	2006-02-27 22:14:51.000000000 +0000
+++ metacity-2.13.144/src/window.c	2006-03-11 15:14:33.000000000 +0000
@@ -1770,9 +1770,9 @@
       return;
     }
 
-  /* Terminal usage is different; users typically intend to launch
+  /* Terminal usage may be different; some users intend to launch
    * many apps in quick succession or to just view things in the new
-   * window while still interacting with the terminal.  Therefore,
+   * window while still interacting with the terminal.  In that case,
    * 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
@@ -1780,6 +1780,7 @@
    */
   if (*takes_focus &&
       !window->display->allow_terminal_deactivation &&
+      meta_prefs_get_strict_focus_approximation () &&
       __window_is_terminal (window->display->focus_window) &&
       !meta_window_is_ancestor_of_transient (window->display->focus_window,
                                              window))
@@ -7887,7 +7888,8 @@
       /* If this is a terminal, user interaction with it means the user likely
        * doesn't want to have focus transferred for now due to new windows.
        */
-      if (__window_is_terminal (window))
+      if (meta_prefs_get_strict_focus_approximation () &&
+          __window_is_terminal (window))
         window->display->allow_terminal_deactivation = FALSE;
     }
 }
--- metacity-2.13.144/src/metacity.schemas.in.configure-terminal-misfeature	2006-01-21 19:15:47.000000000 +0000
+++ metacity-2.13.144/src/metacity.schemas.in	2006-03-11 15:52:40.000000000 +0000
@@ -318,6 +318,26 @@
       </locale>
     </schema>
 
+    <schema>
+      <key>/schemas/apps/metacity/general/strict_focus_approximation</key>
+      <applyto>/apps/metacity/general/strict_focus_approximation</applyto>
+      <owner>metacity</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>If true, don't give focus to applications started from terminals</short>
+         <long>
+           If true, metacity will try to detect applications that
+           are started from terminal windows and avoid giving them
+           focus.  Users who run applications from terminals and
+           don't intend to interact with them, or who find it
+           inconvenient that such applications take focus should
+           enable strict focus approximation.  Everyone else should
+           leave it alone.
+         </long>
+      </locale>
+    </schema>
+
     <!-- Window Keybindings -->
 
     <schema>
--- metacity-2.13.144/src/prefs.h.configure-terminal-misfeature	2006-01-10 19:41:04.000000000 +0000
+++ metacity-2.13.144/src/prefs.h	2006-03-11 14:54:28.000000000 +0000
@@ -50,6 +50,7 @@
   META_PREF_AUDIBLE_BELL,
   META_PREF_VISUAL_BELL_TYPE,
   META_PREF_REDUCED_RESOURCES,
+  META_PREF_STRICT_FOCUS_APPROXIMATION,
   META_PREF_GNOME_ACCESSIBILITY,
   META_PREF_CURSOR_THEME,
   META_PREF_CURSOR_SIZE
@@ -78,6 +79,7 @@
 gboolean                    meta_prefs_get_auto_raise         (void);
 int                         meta_prefs_get_auto_raise_delay   (void);
 gboolean                    meta_prefs_get_reduced_resources  (void);
+gboolean                    meta_prefs_get_strict_focus_approximation (void);
 gboolean                    meta_prefs_get_gnome_accessibility (void);
 
 const char*                 meta_prefs_get_command            (int i);
--- metacity-2.13.144/src/display.h.configure-terminal-misfeature	2006-01-30 17:18:03.000000000 +0000
+++ metacity-2.13.144/src/display.h	2006-03-11 14:57:24.000000000 +0000
@@ -204,11 +204,12 @@
    */
   guint mouse_mode : 1;
 
-  /* Helper var for strict focus for terminals; only relevant if the focus
-   * window is a terminal.  Typically, we don't allow new windows to take
-   * focus away from a terminal, but if the user explicitly did something
-   * that should allow a different window to gain focus (e.g. global
-   * keybinding or clicking on a dock), then we will allow the transfer.
+  /* Helper var for strict focus for terminals; only relevant if strict
+   * focus approximation is enabled and the focus window is a terminal.
+   * Typically, we don't allow new windows to take focus away from a
+   * terminal, but if the user explicitly did something that should allow
+   * a different window to gain focus (e.g. global keybinding or clicking
+   * on a dock), then we will allow the transfer.
    */
   guint allow_terminal_deactivation : 1;
 
