Blame SOURCES/0020-zoom-hotkeys-disable-numpad-when-users-set-new-hotke.patch

0f5b8b
From a0f227c723d424c6f1cf63efa213668e69800e98 Mon Sep 17 00:00:00 2001
0f5b8b
From: Uri Lublin <uril@redhat.com>
0f5b8b
Date: Sun, 10 Jan 2021 17:05:09 +0200
0f5b8b
Subject: [PATCH] zoom hotkeys: disable numpad when users set new hotkeys
0f5b8b
MIME-Version: 1.0
0f5b8b
Content-Type: text/plain; charset=UTF-8
0f5b8b
Content-Transfer-Encoding: 8bit
0f5b8b
0f5b8b
If a user sets any hotkey, disable numpad hotkeys.
0f5b8b
If a user does not set any hotkey and the default hotkeys
0f5b8b
are enabled, then numpad hotkeys are enabled too.
0f5b8b
0f5b8b
This is a folloup for commits a40c8f4 and e89e82e + 8cc0667.
0f5b8b
Currently setting (e.g. ctrl [123]) hotkeys for zoom (in/out/reset),
0f5b8b
re-enable the default numpad hotkeys (ctrl [+-0]).
0f5b8b
0f5b8b
Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1791261
0f5b8b
0f5b8b
Suggested-by: Jakub Janků <jjanku@redhat.com>
0f5b8b
Signed-off-by: Uri Lublin <uril@redhat.com>
0f5b8b
---
0f5b8b
 src/virt-viewer-window.c | 6 ++++--
0f5b8b
 1 file changed, 4 insertions(+), 2 deletions(-)
0f5b8b
0f5b8b
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
0f5b8b
index 5647023..448ef74 100644
0f5b8b
--- a/src/virt-viewer-window.c
0f5b8b
+++ b/src/virt-viewer-window.c
0f5b8b
@@ -905,9 +905,11 @@ virt_viewer_window_enable_modifiers(VirtViewerWindow *self)
0f5b8b
                  "gtk-enable-mnemonics", priv->enable_mnemonics_save,
0f5b8b
                  NULL);
0f5b8b
 
0f5b8b
-    /* if zoom actions using "normal" +/-/0 keys are enabled,
0f5b8b
+    /* if the user did not set hotkeys and
0f5b8b
+     * zoom actions using "normal" +/-/0 keys are enabled,
0f5b8b
      * allow the user to use the numpad +/-/0 keys as well */
0f5b8b
-    if (gtk_accel_map_lookup_entry("<virt-viewer>/view/zoom-out", &key)
0f5b8b
+    if (!virt_viewer_app_get_enable_accel(priv->app)
0f5b8b
+        && gtk_accel_map_lookup_entry("<virt-viewer>/view/zoom-out", &key)
0f5b8b
         && key.accel_key != 0) {
0f5b8b
         g_action_map_add_action_entries(G_ACTION_MAP(priv->window),
0f5b8b
                                         keypad_action_entries, G_N_ELEMENTS(keypad_action_entries),
0f5b8b
-- 
0f5b8b
2.29.2
0f5b8b