Merge libs/ardour and gtk2_ardour with 2.0-ongoing R2837.
[ardour.git] / gtk2_ardour / sync-menu.c
index 229802b324cef4b413f9f7bfd21d58f282242c61..60dff79e07e5ff1d518cc8d3f0f8435df8f88475 100644 (file)
@@ -311,30 +311,45 @@ carbon_menu_item_update_accelerator (CarbonMenuItem *carbon_item,
          GdkKeymap       *keymap  = gdk_keymap_get_for_display (display);
          GdkKeymapKey    *keys;
          gint             n_keys;
+         gint             use_command;
 
          if (gdk_keymap_get_entries_for_keyval (keymap, key->accel_key,
                                                 &keys, &n_keys))
            {
-             UInt8 modifiers = 0;
+            UInt8 modifiers = 0; /* implies Command key */
 
              SetMenuItemCommandKey (carbon_item->menu, carbon_item->index,
                                     true, keys[0].keycode);
 
              g_free (keys);
 
+             use_command = 0;
+
              if (key->accel_mods)
                {
-                 if (key->accel_mods & GDK_SHIFT_MASK)
+                 if (key->accel_mods & GDK_SHIFT_MASK) {
                    modifiers |= kMenuShiftModifier;
+                 }
 
-                 if (key->accel_mods & GDK_MOD1_MASK)
+                 if (key->accel_mods & (GDK_MOD1_MASK)) {
                    modifiers |= kMenuOptionModifier;
-               }
-
-             if (!(key->accel_mods & GDK_CONTROL_MASK))
-               {
-                 modifiers |= kMenuNoCommandModifier;
-               }
+                 }
+
+                 if (key->accel_mods & GDK_CONTROL_MASK) {
+                   modifiers |= kMenuControlModifier;
+                 }
+                 
+                 if (key->accel_mods & GDK_MOD5_MASK) {
+                         /* Mod5 is what ardour's binding file uses to mean "Command"
+                            Nothing needs to be set in modifiers, but we need to notice
+                            that there *is* an implicit modifier
+                         */
+                         use_command = 1;
+                 }
+               }  
+
+             if (!use_command)
+               modifiers |= kMenuNoCommandModifier;
 
              SetMenuItemModifiers (carbon_item->menu, carbon_item->index,
                                    modifiers);