Drop gtk_accelerator_set_default_mod_mask

Our new approach to modifiers works with a fixed set,
there is really no need to customize the modifier
masks if the backends are all supposed to deliver
the same modifiers.
This commit is contained in:
Matthias Clasen 2020-04-05 21:43:57 -04:00
parent f7f103a322
commit 1de7719e34
3 changed files with 7 additions and 40 deletions

View File

@ -60,7 +60,6 @@ gtk_accelerator_get_label
gtk_accelerator_parse_with_keycode gtk_accelerator_parse_with_keycode
gtk_accelerator_name_with_keycode gtk_accelerator_name_with_keycode
gtk_accelerator_get_label_with_keycode gtk_accelerator_get_label_with_keycode
gtk_accelerator_set_default_mod_mask
gtk_accelerator_get_default_mod_mask gtk_accelerator_get_default_mod_mask
</SECTION> </SECTION>

View File

@ -42,14 +42,6 @@
* textual representations of keyboard accelerators. * textual representations of keyboard accelerators.
*/ */
/* --- variables --- */
static guint default_accel_mod_mask = GDK_CONTROL_MASK|
GDK_SHIFT_MASK|
GDK_ALT_MASK|
GDK_SUPER_MASK|
GDK_HYPER_MASK|
GDK_META_MASK;
/* --- functions --- */ /* --- functions --- */
/** /**
@ -993,42 +985,20 @@ gtk_accelerator_print_label (GString *gstring,
} }
} }
/**
* gtk_accelerator_set_default_mod_mask:
* @default_mod_mask: accelerator modifier mask
*
* Sets the modifiers that will be considered significant for keyboard
* accelerators. The default mod mask depends on the GDK backend in use,
* but will typically include #GDK_CONTROL_MASK | #GDK_SHIFT_MASK |
* #GDK_ALT_MASK | #GDK_SUPER_MASK | #GDK_HYPER_MASK | #GDK_META_MASK.
* In other words, Control, Shift, Alt, Super, Hyper and Meta. Other
* modifiers will by default be ignored by #GtkAccelGroup.
*
* You must include at least the three modifiers Control, Shift
* and Alt in any value you pass to this function.
*
* The default mod mask should be changed on application startup,
* before using any accelerator groups.
*/
void
gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask)
{
default_accel_mod_mask = (default_mod_mask & GDK_MODIFIER_MASK) |
(GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_ALT_MASK);
}
/** /**
* gtk_accelerator_get_default_mod_mask: * gtk_accelerator_get_default_mod_mask:
* *
* Gets the modifier mask. * Gets the modifier mask.
* *
* The modifier mask determines which modifiers are considered significant * The modifier mask determines which modifiers are considered significant
* for keyboard accelerators. See gtk_accelerator_set_default_mod_mask(). * for keyboard accelerators. This includes all keyboard modifiers except
* for %GDK_LOCK_MASK.
* *
* Returns: the default accelerator modifier mask * Returns: the modifier mask for accelerators
*/ */
GdkModifierType GdkModifierType
gtk_accelerator_get_default_mod_mask (void) gtk_accelerator_get_default_mod_mask (void)
{ {
return default_accel_mod_mask; return GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_ALT_MASK|
GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK;
} }

View File

@ -67,10 +67,8 @@ gchar* gtk_accelerator_get_label_with_keycode (GdkDisplay *display,
guint keycode, guint keycode,
GdkModifierType accelerator_mods); GdkModifierType accelerator_mods);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask); GdkModifierType gtk_accelerator_get_default_mod_mask (void);
GDK_AVAILABLE_IN_ALL
GdkModifierType
gtk_accelerator_get_default_mod_mask (void);
G_END_DECLS G_END_DECLS