keyboard: Allow Tab in accels
gtk_accelerator_valid() doesn't accept Tab as keyval, so using it to check whether a shortcut is valid breaks commonly used shortcuts like Alt+Tab. Unbreak those by adding a small wrapper that special-cases Tab-with-modifiers. https://bugzilla.gnome.org/show_bug.cgi?id=771058
This commit is contained in:
parent
784d8f89de
commit
4beb7cefd4
3 changed files with 15 additions and 1 deletions
|
@ -282,7 +282,7 @@ setup_custom_shortcut (CcKeyboardShortcutEditor *self)
|
|||
|
||||
is_custom = is_custom_shortcut (self);
|
||||
accel_valid = is_valid_binding (self->custom_keyval, self->custom_mask, self->custom_keycode) &&
|
||||
gtk_accelerator_valid (self->custom_keyval, self->custom_mask) &&
|
||||
is_valid_accel (self->custom_keyval, self->custom_mask) &&
|
||||
!self->custom_is_modifier;
|
||||
if (is_empty_binding (self->custom_keyval, self->custom_mask, self->custom_keycode))
|
||||
accel_valid = TRUE;
|
||||
|
|
|
@ -302,6 +302,17 @@ is_empty_binding (guint keyval,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
is_valid_accel (guint keyval,
|
||||
GdkModifierType mask)
|
||||
{
|
||||
/* Unlike gtk_accelerator_valid(), we want to allow Tab when combined
|
||||
* with some modifiers (Alt+Tab and friends)
|
||||
*/
|
||||
return gtk_accelerator_valid (keyval, mask) ||
|
||||
(keyval == GDK_KEY_Tab && mask != 0);
|
||||
}
|
||||
|
||||
gchar*
|
||||
find_free_settings_path (GSettings *settings)
|
||||
{
|
||||
|
|
|
@ -93,6 +93,9 @@ gboolean is_empty_binding (guint keyval,
|
|||
GdkModifierType mask,
|
||||
guint keycode);
|
||||
|
||||
gboolean is_valid_accel (guint keyval,
|
||||
GdkModifierType mask);
|
||||
|
||||
KeyList* parse_keylist_from_file (const gchar *path);
|
||||
|
||||
gchar* convert_keysym_state_to_string (guint keysym,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue