[gnome-flashback] common: fix keyboard shortcuts with Tab key
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] common: fix keyboard shortcuts with Tab key
- Date: Sat, 17 Aug 2019 12:56:28 +0000 (UTC)
commit 5835836e88642f9eee7c3f49fa8228d694315121
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Aug 17 15:50:41 2019 +0300
common: fix keyboard shortcuts with Tab key
https://gitlab.gnome.org/GNOME/gnome-control-center/blob/gnome-3-32/panels/keyboard/keyboard-shortcuts.c#L300
https://gitlab.gnome.org/GNOME/gnome-flashback/merge_requests/13#note_347865
gnome-flashback/libcommon/gf-keybindings.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gnome-flashback/libcommon/gf-keybindings.c b/gnome-flashback/libcommon/gf-keybindings.c
index d518b1a..0c21e4e 100644
--- a/gnome-flashback/libcommon/gf-keybindings.c
+++ b/gnome-flashback/libcommon/gf-keybindings.c
@@ -89,6 +89,17 @@ static GParamSpec *properties[LAST_PROP] = { NULL };
G_DEFINE_TYPE (GfKeybindings, gf_keybindings, G_TYPE_OBJECT)
+static gboolean
+is_valid_accelerator (guint keyval,
+ GdkModifierType modifiers)
+{
+ /* Unlike gtk_accelerator_valid(), we want to allow Tab when combined
+ * with some modifiers (Alt+Tab and friends)
+ */
+ return gtk_accelerator_valid (keyval, modifiers) ||
+ (keyval == GDK_KEY_Tab && modifiers != 0);
+}
+
static gboolean
devirtualize_modifier (GdkModifierType modifiers,
GdkModifierType gdk_mask,
@@ -491,7 +502,7 @@ reload_keybindings (GfKeybindings *keybindings)
gtk_accelerator_parse (keybinding->name, &keyval, &modifiers);
- if (gtk_accelerator_valid (keyval, modifiers) && keyval != 0)
+ if (is_valid_accelerator (keyval, modifiers))
{
keycode = XKeysymToKeycode (keybindings->xdisplay, keyval);
@@ -919,7 +930,7 @@ gf_keybindings_grab (GfKeybindings *keybindings,
gtk_accelerator_parse (accelerator, &keyval, &modifiers);
- if (!gtk_accelerator_valid (keyval, modifiers))
+ if (!is_valid_accelerator (keyval, modifiers))
return 0;
if (keyval == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]