rpms/metacity/FC-5 metacity-2.14.2-strict.patch, NONE, 1.1 metacity.spec, 1.65, 1.66

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Apr 12 21:43:39 UTC 2006


Author: rstrode

Update of /cvs/dist/rpms/metacity/FC-5
In directory cvs.devel.redhat.com:/tmp/cvs-serv21476

Modified Files:
	metacity.spec 
Added Files:
	metacity-2.14.2-strict.patch 
Log Message:
- Make strict focus mode optional (off by default), bug 326159


metacity-2.14.2-strict.patch:
 common.h            |    6 +++++
 display.h           |   11 +++++-----
 metacity.schemas.in |   17 ++++++++++++++++
 prefs.c             |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 prefs.h             |    2 +
 window.c            |    9 +++++---
 6 files changed, 92 insertions(+), 8 deletions(-)

--- NEW FILE metacity-2.14.2-strict.patch ---
--- metacity-2.14.0/src/prefs.h.focus-new-windows	2006-03-03 18:34:22.000000000 +0000
+++ metacity-2.14.0/src/prefs.h	2006-03-25 11:11:22.000000000 +0000
@@ -31,6 +31,7 @@ typedef enum
 {
   META_PREF_MOUSE_BUTTON_MODS,
   META_PREF_FOCUS_MODE,
+  META_PREF_FOCUS_NEW_WINDOWS,
   META_PREF_RAISE_ON_CLICK,
   META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
   META_PREF_AUTO_RAISE,
@@ -68,6 +69,7 @@ const char* meta_preference_to_string (M
 
 MetaVirtualModifier         meta_prefs_get_mouse_button_mods  (void);
 MetaFocusMode               meta_prefs_get_focus_mode         (void);
+MetaFocusNewWindows         meta_prefs_get_focus_new_windows  (void);
 gboolean                    meta_prefs_get_raise_on_click     (void);
 const char*                 meta_prefs_get_theme              (void);
 /* returns NULL if GTK default should be used */
--- metacity-2.14.0/src/common.h.focus-new-windows	2006-01-21 19:15:47.000000000 +0000
+++ metacity-2.14.0/src/common.h	2006-03-25 11:00:43.000000000 +0000
@@ -153,6 +153,12 @@ typedef enum
 
 typedef enum
 {
+  META_FOCUS_NEW_WINDOWS_SMART,
+  META_FOCUS_NEW_WINDOWS_STRICT
+} MetaFocusNewWindows;
+
+typedef enum
+{
   META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE,
   META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE,
   META_ACTION_DOUBLE_CLICK_TITLEBAR_MINIMIZE,
--- metacity-2.14.0/src/metacity.schemas.in.focus-new-windows	2006-03-03 18:34:22.000000000 +0000
+++ metacity-2.14.0/src/metacity.schemas.in	2006-03-25 10:54:01.000000000 +0000
@@ -67,6 +67,23 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/metacity/general/focus_new_windows</key>
+      <applyto>/apps/metacity/general/focus_new_windows</applyto>
+      <owner>metacity</owner>
+      <type>string</type>
+      <default>smart</default>
+      <locale name="C">
+         <short>Control how new windows get focus</short>
+         <long>
+          This option provides additional control over how newly created
+          windows get focus.  It has two possible values; "smart" applies
+          the user's normal focus mode, and "strict" results in windows
+          started from a terminal not being given focus.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/metacity/general/raise_on_click</key>
       <applyto>/apps/metacity/general/raise_on_click</applyto>
       <owner>metacity</owner>
--- metacity-2.14.0/src/window.c.focus-new-windows	2006-03-13 22:35:25.000000000 +0000
+++ metacity-2.14.0/src/window.c	2006-03-25 11:25:30.000000000 +0000
@@ -1771,15 +1771,16 @@ window_state_on_map (MetaWindow *window,
       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
    * approximation to enforce so we do that.
    */
   if (*takes_focus &&
+      meta_prefs_get_focus_new_windows () == META_FOCUS_NEW_WINDOWS_STRICT &&
       !window->display->allow_terminal_deactivation &&
       __window_is_terminal (window->display->focus_window) &&
       !meta_window_is_ancestor_of_transient (window->display->focus_window,
@@ -7888,7 +7889,9 @@ meta_window_set_user_time (MetaWindow *w
       /* 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_focus_new_windows () ==
+               META_FOCUS_NEW_WINDOWS_STRICT &&
+          __window_is_terminal (window))
         window->display->allow_terminal_deactivation = FALSE;
     }
 }
--- metacity-2.14.0/src/display.h.focus-new-windows	2006-01-30 17:18:03.000000000 +0000
+++ metacity-2.14.0/src/display.h	2006-03-25 11:10:21.000000000 +0000
@@ -204,11 +204,12 @@ struct _MetaDisplay
    */
   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 in strict
+   * new window focus mode and if the focus window is a terminal.  In that
+   * case, 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;
 
--- metacity-2.14.0/src/prefs.c.focus-new-windows	2006-03-03 18:34:22.000000000 +0000
+++ metacity-2.14.0/src/prefs.c	2006-03-25 11:00:18.000000000 +0000
@@ -42,6 +42,7 @@
  */
 #define KEY_MOUSE_BUTTON_MODS "/apps/metacity/general/mouse_button_modifier"
 #define KEY_FOCUS_MODE "/apps/metacity/general/focus_mode"
+#define KEY_FOCUS_NEW_WINDOWS "/apps/metacity/general/focus_new_windows"
 #define KEY_RAISE_ON_CLICK "/apps/metacity/general/raise_on_click"
 #define KEY_ACTION_DOUBLE_CLICK_TITLEBAR "/apps/metacity/general/action_double_click_titlebar"
 #define KEY_AUTO_RAISE "/apps/metacity/general/auto_raise"
@@ -82,6 +83,7 @@ static gboolean use_system_font = FALSE;
 static PangoFontDescription *titlebar_font = NULL;
 static MetaVirtualModifier mouse_button_mods = Mod1Mask;
 static MetaFocusMode focus_mode = META_FOCUS_MODE_CLICK;
+static MetaFocusNewWindows focus_new_windows = META_FOCUS_NEW_WINDOWS_SMART;
 static gboolean raise_on_click = TRUE;
 static char* current_theme = NULL;
 static int num_workspaces = 4;
@@ -126,6 +128,7 @@ static gboolean update_use_system_font  
 static gboolean update_titlebar_font      (const char *value);
 static gboolean update_mouse_button_mods  (const char *value);
 static gboolean update_focus_mode         (const char *value);
+static gboolean update_focus_new_windows  (const char *value);
 static gboolean update_raise_on_click     (gboolean    value);
 static gboolean update_theme              (const char *value);
 static gboolean update_visual_bell        (gboolean v1, gboolean v2);
@@ -375,6 +378,12 @@ meta_prefs_init (void)
   update_focus_mode (str_val);
   g_free (str_val);  
 
+  str_val = gconf_client_get_string (default_client, KEY_FOCUS_NEW_WINDOWS,
+                                     &err);
+  cleanup_error (&err);
+  update_focus_new_windows (str_val);
+  g_free (str_val);  
+
   if (get_bool (KEY_RAISE_ON_CLICK, &bool_val))
     update_raise_on_click (bool_val);
   
@@ -583,6 +592,22 @@ change_notify (GConfClient    *client,
       if (update_focus_mode (str))
         queue_changed (META_PREF_FOCUS_MODE);
     }
+  else if (strcmp (key, KEY_FOCUS_NEW_WINDOWS) == 0)
+    {
+      const char *str;
+
+      if (value && value->type != GCONF_VALUE_STRING)
+        {
+          meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
+                        KEY_FOCUS_NEW_WINDOWS);
+          goto out;
+        }
+      
+      str = value ? gconf_value_get_string (value) : NULL;
+
+      if (update_focus_new_windows (str))
+        queue_changed (META_PREF_FOCUS_NEW_WINDOWS);
+    }
   else if (strcmp (key, KEY_RAISE_ON_CLICK) == 0)
     {
       gboolean b;
@@ -1022,6 +1047,27 @@ update_focus_mode (const char *value)
 
 #ifdef HAVE_GCONF
 static gboolean
+update_focus_new_windows (const char *value)
+{
+  MetaFocusNewWindows old_mode = focus_new_windows;
+  
+  if (value != NULL)
+    {
+      if (g_ascii_strcasecmp (value, "smart") == 0)
+        focus_new_windows = META_FOCUS_NEW_WINDOWS_SMART;
+      else if (g_ascii_strcasecmp (value, "strict") == 0)
+        focus_new_windows = META_FOCUS_NEW_WINDOWS_STRICT;
+      else
+        meta_warning (_("GConf key '%s' is set to an invalid value\n"),
+                      KEY_FOCUS_NEW_WINDOWS);
+    }
+
+  return (old_mode != focus_new_windows);
+}
+#endif /* HAVE_GCONF */
+
+#ifdef HAVE_GCONF
+static gboolean
 update_raise_on_click (gboolean value)
 {
   gboolean old = raise_on_click;
@@ -1078,6 +1124,12 @@ meta_prefs_get_focus_mode (void)
   return focus_mode;
 }
 
+MetaFocusNewWindows
+meta_prefs_get_focus_new_windows (void)
+{
+  return focus_new_windows;
+}
+
 gboolean
 meta_prefs_get_raise_on_click (void)
 {
@@ -1573,6 +1625,9 @@ meta_preference_to_string (MetaPreferenc
     case META_PREF_FOCUS_MODE:
       return "FOCUS_MODE";
 
+    case META_PREF_FOCUS_NEW_WINDOWS:
+      return "FOCUS_NEW_WINDOWS";
+
     case META_PREF_RAISE_ON_CLICK:
       return "RAISE_ON_CLICK";
       


Index: metacity.spec
===================================================================
RCS file: /cvs/dist/rpms/metacity/FC-5/metacity.spec,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- metacity.spec	11 Apr 2006 03:22:16 -0000	1.65
+++ metacity.spec	12 Apr 2006 21:43:37 -0000	1.66
@@ -7,7 +7,7 @@
 Summary: Metacity window manager
 Name: metacity
 Version: %{metacity_version}
-Release: 1.fc5.1
+Release: 1.fc5.2
 URL: http://ftp.gnome.org/pub/gnome/sources/metacity/
 Source0: metacity-%{metacity_version}.tar.bz2
 Source1: libcm-%{libcm_version}.0.%{libcm_snapshot_date}.tar.bz2
@@ -37,6 +37,7 @@
 Patch1: metacity-2.13.144-bling.patch
 Patch2: metacity-2.13.89.0.2006.02.16-static-cm.patch
 Patch3: metacity-2.13.89.0.2006.02.16-fix-type.patch
+Patch4: metacity-2.14.2-strict.patch
 
 %description
 
@@ -51,6 +52,7 @@
 %patch1 -p1 -b .bling
 %patch2 -p1 -b .static-cm
 %patch3 -p1 -b .fix-type
+%patch4 -p1 -b .strict
 
 %build
 rm -rf $RPM_BUILD_ROOT
@@ -142,6 +144,9 @@
 %{_mandir}/man1/*
 
 %changelog
+* Wed Apr 12 2006 Ray Strode <rstrode at redhat.com> - 2.14.2-1.fc5.2
+- Make strict focus mode optional (off by default), bug 326159
+
 * Mon Apr 10 2006 Matthias Clasen <mclasen at redhat.com> - 2.14.2-1.fc5.1
 - Update to 2.14.2
 




More information about the fedora-cvs-commits mailing list