diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c index b9af3b67d2..6ffa6f8898 100644 --- a/gtk/gtkaccelgroup.c +++ b/gtk/gtkaccelgroup.c @@ -276,6 +276,7 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator, GdkModifierType mods; gint len; gboolean error; + GdkModifierType primary; if (accelerator_key) *accelerator_key = 0; @@ -286,6 +287,12 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator, g_return_val_if_fail (accelerator != NULL, FALSE); + if (!display) + display = gdk_display_get_default (); + + primary = gdk_display_get_modifier_mask (display, + GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR); + error = FALSE; keyval = 0; mods = 0; @@ -298,7 +305,7 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator, { accelerator += 9; len -= 9; - mods |= _gtk_get_primary_accel_mod (); + mods |= primary; } else if (len >= 9 && is_control (accelerator)) { @@ -540,7 +547,6 @@ gtk_accelerator_name_with_keycode (GdkDisplay *display, if (display == NULL) display = gdk_display_manager_get_default_display (gdk_display_manager_get ()); - gdk_keymap_add_virtual_modifiers (gdk_display_get_keymap (display), &accelerator_mods); gtk_name = gtk_accelerator_name (accelerator_key, accelerator_mods); if (!accelerator_key) @@ -583,6 +589,10 @@ gtk_accelerator_name (guint accelerator_key, guint l; const char *keyval_name; gchar *accelerator; + GdkModifierType primary; + + primary = gdk_display_get_modifier_mask (gdk_display_get_default (), + GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR); accelerator_mods &= GDK_MODIFIER_MASK; @@ -592,10 +602,10 @@ gtk_accelerator_name (guint accelerator_key, saved_mods = accelerator_mods; l = 0; - if (accelerator_mods & _gtk_get_primary_accel_mod ()) + if (accelerator_mods & primary) { l += sizeof (text_primary) - 1; - accelerator_mods &= ~_gtk_get_primary_accel_mod (); /* consume the default accel */ + accelerator_mods &= ~primary; /* consume the default accel */ } if (accelerator_mods & GDK_SHIFT_MASK) l += sizeof (text_shift) - 1; @@ -615,11 +625,11 @@ gtk_accelerator_name (guint accelerator_key, accelerator_mods = saved_mods; l = 0; accelerator[l] = 0; - if (accelerator_mods & _gtk_get_primary_accel_mod ()) + if (accelerator_mods & primary) { strcpy (accelerator + l, text_primary); l += sizeof (text_primary) - 1; - accelerator_mods &= ~_gtk_get_primary_accel_mod (); /* consume the default accel */ + accelerator_mods &= ~primary; /* consume the default accel */ } if (accelerator_mods & GDK_SHIFT_MASK) { @@ -684,7 +694,6 @@ gtk_accelerator_get_label_with_keycode (GdkDisplay *display, if (display == NULL) display = gdk_display_manager_get_default_display (gdk_display_manager_get ()); - gdk_keymap_add_virtual_modifiers (gdk_display_get_keymap (display), &accelerator_mods); gtk_label = gtk_accelerator_get_label (accelerator_key, accelerator_mods); if (!accelerator_key) diff --git a/gtk/gtkprivate.c b/gtk/gtkprivate.c index b61333d71c..05aba4aaf5 100644 --- a/gtk/gtkprivate.c +++ b/gtk/gtkprivate.c @@ -158,35 +158,6 @@ _gtk_single_string_accumulator (GSignalInvocationHint *ihint, return continue_emission; } -GdkModifierType -_gtk_replace_virtual_modifiers (GdkKeymap *keymap, - GdkModifierType modifiers) -{ - GdkModifierType result = 0; - gint i; - - g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0); - - for (i = 0; i < 8; i++) /* SHIFT...MOD5 */ - { - GdkModifierType real = 1 << i; - - if (modifiers & real) - { - GdkModifierType virtual = real; - - gdk_keymap_add_virtual_modifiers (keymap, &virtual); - - if (virtual == real) - result |= virtual; - else - result |= virtual & ~real; - } - } - - return result; -} - GdkModifierType _gtk_get_primary_accel_mod (void) { @@ -198,8 +169,6 @@ _gtk_get_primary_accel_mod (void) primary = gdk_display_get_modifier_mask (display, GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR); - primary = _gtk_replace_virtual_modifiers (gdk_display_get_keymap (display), - primary); } return primary; diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h index de94c03a9b..4a29a6ea8f 100644 --- a/gtk/gtkprivate.h +++ b/gtk/gtkprivate.h @@ -82,8 +82,6 @@ gboolean _gtk_single_string_accumulator (GSignalInvocationHint *ihint, const GValue *handler_return, gpointer dummy); -GdkModifierType _gtk_replace_virtual_modifiers (GdkKeymap *keymap, - GdkModifierType modifiers); GdkModifierType _gtk_get_primary_accel_mod (void); gboolean gtk_propagate_event_internal (GtkWidget *widget,