[gthumb] shortcuts: fixed match function
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] shortcuts: fixed match function
- Date: Sun, 24 Nov 2019 12:36:10 +0000 (UTC)
commit 80b9731119b9c396ebaa897f22e83237e6f60599
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Nov 22 10:02:24 2019 +0100
shortcuts: fixed match function
* Convert keycode to lower case
* Remove flags not related to the window mode
gthumb/gth-shortcut.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gthumb/gth-shortcut.c b/gthumb/gth-shortcut.c
index 9dfb2199..e812da7b 100644
--- a/gthumb/gth-shortcut.c
+++ b/gthumb/gth-shortcut.c
@@ -133,10 +133,14 @@ gth_shortcut_array_find (GPtrArray *shortcuts_v,
if (keycode == 0)
return NULL;
+ /* Remove flags not related to the window mode. */
+ context = context & GTH_SHORTCUT_CONTEXT_ANY;
+ keycode = gdk_keyval_to_lower (keycode);
+
for (i = 0; i < shortcuts_v->len; i++) {
GthShortcut *shortcut = g_ptr_array_index (shortcuts_v, i);
- if (((shortcut->context & context) == context)
+ if (((shortcut->context & context) != 0)
&& (shortcut->keyval == keycode)
&& (shortcut->modifiers == modifiers))
{
@@ -158,10 +162,13 @@ gth_shortcut_array_find_by_accel (GPtrArray *shortcuts_v,
if (accelerator == NULL)
return NULL;
+ /* Remove flags not related to the window mode. */
+ context = context & GTH_SHORTCUT_CONTEXT_ANY;
+
for (i = 0; i < shortcuts_v->len; i++) {
GthShortcut *shortcut = g_ptr_array_index (shortcuts_v, i);
- if (((shortcut->context & context) == context)
+ if (((shortcut->context & context) != 0)
&& (g_strcmp0 (shortcut->accelerator, accelerator) == 0))
{
return shortcut;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]