mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
gtk: Remove handling of virtual modifiers
These are going away. We expect to just have named modifiers in modifier masks now, so we longer juggle 'real' and 'virtual' modifiers.
This commit is contained in:
parent
5ce05a8fd0
commit
5071367794
@ -276,6 +276,7 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator,
|
|||||||
GdkModifierType mods;
|
GdkModifierType mods;
|
||||||
gint len;
|
gint len;
|
||||||
gboolean error;
|
gboolean error;
|
||||||
|
GdkModifierType primary;
|
||||||
|
|
||||||
if (accelerator_key)
|
if (accelerator_key)
|
||||||
*accelerator_key = 0;
|
*accelerator_key = 0;
|
||||||
@ -286,6 +287,12 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator,
|
|||||||
|
|
||||||
g_return_val_if_fail (accelerator != NULL, FALSE);
|
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;
|
error = FALSE;
|
||||||
keyval = 0;
|
keyval = 0;
|
||||||
mods = 0;
|
mods = 0;
|
||||||
@ -298,7 +305,7 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator,
|
|||||||
{
|
{
|
||||||
accelerator += 9;
|
accelerator += 9;
|
||||||
len -= 9;
|
len -= 9;
|
||||||
mods |= _gtk_get_primary_accel_mod ();
|
mods |= primary;
|
||||||
}
|
}
|
||||||
else if (len >= 9 && is_control (accelerator))
|
else if (len >= 9 && is_control (accelerator))
|
||||||
{
|
{
|
||||||
@ -540,7 +547,6 @@ gtk_accelerator_name_with_keycode (GdkDisplay *display,
|
|||||||
if (display == NULL)
|
if (display == NULL)
|
||||||
display = gdk_display_manager_get_default_display (gdk_display_manager_get ());
|
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);
|
gtk_name = gtk_accelerator_name (accelerator_key, accelerator_mods);
|
||||||
|
|
||||||
if (!accelerator_key)
|
if (!accelerator_key)
|
||||||
@ -583,6 +589,10 @@ gtk_accelerator_name (guint accelerator_key,
|
|||||||
guint l;
|
guint l;
|
||||||
const char *keyval_name;
|
const char *keyval_name;
|
||||||
gchar *accelerator;
|
gchar *accelerator;
|
||||||
|
GdkModifierType primary;
|
||||||
|
|
||||||
|
primary = gdk_display_get_modifier_mask (gdk_display_get_default (),
|
||||||
|
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
|
||||||
|
|
||||||
accelerator_mods &= GDK_MODIFIER_MASK;
|
accelerator_mods &= GDK_MODIFIER_MASK;
|
||||||
|
|
||||||
@ -592,10 +602,10 @@ gtk_accelerator_name (guint accelerator_key,
|
|||||||
|
|
||||||
saved_mods = accelerator_mods;
|
saved_mods = accelerator_mods;
|
||||||
l = 0;
|
l = 0;
|
||||||
if (accelerator_mods & _gtk_get_primary_accel_mod ())
|
if (accelerator_mods & primary)
|
||||||
{
|
{
|
||||||
l += sizeof (text_primary) - 1;
|
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)
|
if (accelerator_mods & GDK_SHIFT_MASK)
|
||||||
l += sizeof (text_shift) - 1;
|
l += sizeof (text_shift) - 1;
|
||||||
@ -615,11 +625,11 @@ gtk_accelerator_name (guint accelerator_key,
|
|||||||
accelerator_mods = saved_mods;
|
accelerator_mods = saved_mods;
|
||||||
l = 0;
|
l = 0;
|
||||||
accelerator[l] = 0;
|
accelerator[l] = 0;
|
||||||
if (accelerator_mods & _gtk_get_primary_accel_mod ())
|
if (accelerator_mods & primary)
|
||||||
{
|
{
|
||||||
strcpy (accelerator + l, text_primary);
|
strcpy (accelerator + l, text_primary);
|
||||||
l += sizeof (text_primary) - 1;
|
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)
|
if (accelerator_mods & GDK_SHIFT_MASK)
|
||||||
{
|
{
|
||||||
@ -684,7 +694,6 @@ gtk_accelerator_get_label_with_keycode (GdkDisplay *display,
|
|||||||
if (display == NULL)
|
if (display == NULL)
|
||||||
display = gdk_display_manager_get_default_display (gdk_display_manager_get ());
|
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);
|
gtk_label = gtk_accelerator_get_label (accelerator_key, accelerator_mods);
|
||||||
|
|
||||||
if (!accelerator_key)
|
if (!accelerator_key)
|
||||||
|
@ -158,35 +158,6 @@ _gtk_single_string_accumulator (GSignalInvocationHint *ihint,
|
|||||||
return continue_emission;
|
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
|
GdkModifierType
|
||||||
_gtk_get_primary_accel_mod (void)
|
_gtk_get_primary_accel_mod (void)
|
||||||
{
|
{
|
||||||
@ -198,8 +169,6 @@ _gtk_get_primary_accel_mod (void)
|
|||||||
|
|
||||||
primary = gdk_display_get_modifier_mask (display,
|
primary = gdk_display_get_modifier_mask (display,
|
||||||
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
|
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
|
||||||
primary = _gtk_replace_virtual_modifiers (gdk_display_get_keymap (display),
|
|
||||||
primary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return primary;
|
return primary;
|
||||||
|
@ -82,8 +82,6 @@ gboolean _gtk_single_string_accumulator (GSignalInvocationHint *ihint,
|
|||||||
const GValue *handler_return,
|
const GValue *handler_return,
|
||||||
gpointer dummy);
|
gpointer dummy);
|
||||||
|
|
||||||
GdkModifierType _gtk_replace_virtual_modifiers (GdkKeymap *keymap,
|
|
||||||
GdkModifierType modifiers);
|
|
||||||
GdkModifierType _gtk_get_primary_accel_mod (void);
|
GdkModifierType _gtk_get_primary_accel_mod (void);
|
||||||
|
|
||||||
gboolean gtk_propagate_event_internal (GtkWidget *widget,
|
gboolean gtk_propagate_event_internal (GtkWidget *widget,
|
||||||
|
Loading…
Reference in New Issue
Block a user