? po/.intltool-merge-cache
? po/stamp-it
? src/.prefs.c.swp
? src/libmetacity-private.la
? src/libmetacity_private_la-gradient.lo
? src/libmetacity_private_la-preview-widget.lo
? src/libmetacity_private_la-theme-parser.lo
? src/libmetacity_private_la-theme.lo
? src/libmetacity_private_la-util.lo
? src/tools/.deps
? src/tools/.libs
? src/wm-tester/.deps
? src/wm-tester/.libs
Index: src/prefs.c
===================================================================
RCS file: /cvs/gnome/metacity/src/prefs.c,v
retrieving revision 1.59
diff -u -p -r1.59 prefs.c
--- src/prefs.c	24 Jan 2006 01:07:41 -0000	1.59
+++ src/prefs.c	15 Feb 2006 02:41:40 -0000
@@ -1987,6 +1987,7 @@ update_binding (MetaKeyPref *binding,
   unsigned int keysym;
   MetaVirtualModifier mods;
   gboolean changed;
+  gboolean must_revert = FALSE;
   
   meta_topic (META_DEBUG_KEYBINDINGS,
               "Binding \"%s\" has new gconf value \"%s\"\n",
@@ -2002,7 +2003,74 @@ update_binding (MetaKeyPref *binding,
                       "Failed to parse new gconf value\n");
           meta_warning (_("\"%s\" found in configuration database is not a valid value for keybinding \"%s\"\n"),
                         value, binding->name);
+
+          return FALSE;
         }
+    }
+
+  /* Bug 329676: Bindings which can be shifted must not have no modifiers,
+   * nor only SHIFT as a modifier.
+   */
+
+  if (binding->add_shift &&
+      0 != keysym &&
+      (META_VIRTUAL_SHIFT_MASK == mods || 0 == mods))
+    {
+      meta_warning ("Cannot bind \"%s\" to %s: it needs a modifier "
+                    "such as Ctrl or Alt.\n",
+                    binding->name,
+                    value);
+
+      must_revert = TRUE;
+    }
+
+  if (must_revert)
+    {
+      gchar *old_setting;
+      gchar *key;
+      GError *err = NULL;
+      
+      old_setting = meta_ui_accelerator_name(
+                      binding->keysym,
+                      binding->modifiers);
+      
+      if (!strcmp(old_setting, value))
+        {
+          /* We were about to set it to the same value
+           * that it had originally! This must be caused
+           * by getting an invalid string back from
+           * meta_ui_accelerator_name. Bail out now
+           * so we don't get into an infinite loop.
+           */
+           return TRUE;
+        }
+
+      meta_warning ("Reverting \"%s\" to %s.\n",
+                    binding->name,
+                    old_setting);
+
+      key = g_strconcat (KEY_SCREEN_BINDINGS_PREFIX, "/",
+                         binding->name, NULL);
+      
+      gconf_client_set_string (gconf_client_get_default (),
+                               key, old_setting, &err);
+
+      if (err)
+        {
+          meta_warning ("Error while reverting keybinding: %s\n",
+                        err->message);
+          g_error_free (err);
+          err = NULL;
+        }
+      
+      g_free (old_setting);
+      g_free (key);
+
+      /* The call to gconf_client_set_string() will cause this function
+       * to be called again with the new value, so there's no need to
+       * carry on.
+       */
+      return TRUE;
     }
   
   changed = FALSE;
Index: src/ui.c
===================================================================
RCS file: /cvs/gnome/metacity/src/ui.c,v
retrieving revision 1.57
diff -u -p -r1.57 ui.c
--- src/ui.c	22 Sep 2004 18:57:36 -0000	1.57
+++ src/ui.c	15 Feb 2006 02:41:41 -0000
@@ -788,6 +788,42 @@ meta_ui_parse_accelerator (const char   
   return TRUE;
 }
 
+gchar*
+meta_ui_accelerator_name  (unsigned int        keysym,
+                           MetaVirtualModifier mask)
+{
+  EggVirtualModifierType mods = 0;
+        
+  if (keysym == 0 && mask == 0)
+    {
+      return strdup ("disabled");
+    }
+
+  if (mask & META_VIRTUAL_SHIFT_MASK)
+    mods |= EGG_VIRTUAL_SHIFT_MASK;
+  if (mask & META_VIRTUAL_CONTROL_MASK)
+    mods |= EGG_VIRTUAL_CONTROL_MASK;
+  if (mask & META_VIRTUAL_ALT_MASK)
+    mods |= EGG_VIRTUAL_ALT_MASK;
+  if (mask & META_VIRTUAL_MOD2_MASK)
+    mods |= EGG_VIRTUAL_MOD2_MASK;
+  if (mask & META_VIRTUAL_MOD3_MASK)
+    mods |= EGG_VIRTUAL_MOD3_MASK;
+  if (mask & META_VIRTUAL_MOD4_MASK)
+    mods |= EGG_VIRTUAL_MOD4_MASK;
+  if (mask & META_VIRTUAL_MOD5_MASK)
+    mods |= EGG_VIRTUAL_MOD5_MASK;
+  if (mask & META_VIRTUAL_SUPER_MASK)
+    mods |= EGG_VIRTUAL_SUPER_MASK;
+  if (mask & META_VIRTUAL_HYPER_MASK)
+    mods |= EGG_VIRTUAL_HYPER_MASK;
+  if (mask & META_VIRTUAL_META_MASK)
+    mods |= EGG_VIRTUAL_META_MASK;
+
+  return egg_virtual_accelerator_name (keysym, mods);
+
+}
+
 gboolean
 meta_ui_parse_modifier (const char          *accel,
                         MetaVirtualModifier *mask)
Index: src/ui.h
===================================================================
RCS file: /cvs/gnome/metacity/src/ui.h,v
retrieving revision 1.34
diff -u -p -r1.34 ui.h
--- src/ui.h	10 Jan 2004 17:16:07 -0000	1.34
+++ src/ui.h	15 Feb 2006 02:41:41 -0000
@@ -185,6 +185,8 @@ gboolean meta_ui_parse_accelerator (cons
 gboolean meta_ui_parse_modifier    (const char          *accel,
                                     MetaVirtualModifier *mask);
 
+gchar*   meta_ui_accelerator_name  (unsigned int        keysym,
+                                    MetaVirtualModifier mask);
 gboolean meta_ui_window_is_widget (MetaUI *ui,
                                    Window  xwindow);
 
