summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ralls <jralls@ceridwen.us>2014-12-24 16:10:12 -0800
committerMatthias Clasen <mclasen@redhat.com>2015-08-25 15:54:58 -0400
commitc55ff6e41fb3c6272b5e7a084c8273dea60d7dee (patch)
treea49e8f954aa091cb9d0de4dac1059f55946d70c6
parent30d56933d44d88c3f99b9f5e0c8d5264694026c3 (diff)
downloadgtk+-c55ff6e41fb3c6272b5e7a084c8273dea60d7dee.tar.gz
Bug 736125 - The default gtk accelerator mod mask does not include all default backend modifiers
-rw-r--r--gdk/gdkkeys.c4
-rw-r--r--gdk/gdktypes.h8
-rw-r--r--gdk/quartz/gdkkeys-quartz.c5
-rw-r--r--gtk/gtkaccelgroup.c12
4 files changed, 22 insertions, 7 deletions
diff --git a/gdk/gdkkeys.c b/gdk/gdkkeys.c
index c651205f7a..9302f425e9 100644
--- a/gdk/gdkkeys.c
+++ b/gdk/gdkkeys.c
@@ -653,6 +653,10 @@ gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
return 0;
+ case GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK:
+ return (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK |
+ GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_META_MASK);
+
default:
g_return_val_if_reached (0);
}
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 4c355aa5eb..252922d569 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -291,6 +291,11 @@ typedef enum
* input methods, and for use cases like typeahead search.
* @GDK_MODIFIER_INTENT_SHIFT_GROUP: the modifier that switches between keyboard
* groups (AltGr on X11/Windows and Option/Alt on OS X).
+ * @GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK: The set of modifier masks accepted
+ * as modifiers in accelerators. Needed because Command is mapped to MOD2 on
+ * OSX, which is widely used, but on X11 MOD2 is NumLock and using that for a
+ * mod key is problematic at best.
+ * Ref: https://bugzilla.gnome.org/show_bug.cgi?id=736125.
*
* This enum is used with gdk_keymap_get_modifier_mask()
* in order to determine what modifiers the
@@ -309,7 +314,8 @@ typedef enum
GDK_MODIFIER_INTENT_EXTEND_SELECTION,
GDK_MODIFIER_INTENT_MODIFY_SELECTION,
GDK_MODIFIER_INTENT_NO_TEXT_INPUT,
- GDK_MODIFIER_INTENT_SHIFT_GROUP
+ GDK_MODIFIER_INTENT_SHIFT_GROUP,
+ GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK,
} GdkModifierIntent;
typedef enum
diff --git a/gdk/quartz/gdkkeys-quartz.c b/gdk/quartz/gdkkeys-quartz.c
index b2a52ed9f0..f9857831c9 100644
--- a/gdk/quartz/gdkkeys-quartz.c
+++ b/gdk/quartz/gdkkeys-quartz.c
@@ -761,6 +761,11 @@ gdk_quartz_keymap_get_modifier_mask (GdkKeymap *keymap,
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
return GDK_MOD1_MASK;
+ case GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK:
+ return (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK |
+ GDK_MOD2_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK |
+ GDK_META_MASK);
+
default:
g_return_val_if_reached (0);
}
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 0523efe87a..15a27d48d4 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -73,12 +73,7 @@ static void accel_closure_invalidate (gpointer data,
static guint signal_accel_activate = 0;
static guint signal_accel_changed = 0;
static guint quark_acceleratable_groups = 0;
-static guint default_accel_mod_mask = (GDK_SHIFT_MASK |
- GDK_CONTROL_MASK |
- GDK_MOD1_MASK |
- GDK_SUPER_MASK |
- GDK_HYPER_MASK |
- GDK_META_MASK);
+static guint default_accel_mod_mask = 0;
enum {
PROP_0,
@@ -1752,5 +1747,10 @@ gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask)
GdkModifierType
gtk_accelerator_get_default_mod_mask (void)
{
+ if (!default_accel_mod_mask)
+ default_accel_mod_mask =
+ gdk_keymap_get_modifier_mask (gdk_keymap_get_default (),
+ GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK);
+
return default_accel_mod_mask;
}