zoom hotkeys: disable numpad when users set new hotkeys

If a user sets any hotkey, disable numpad hotkeys.
If a user does not set any hotkey and the default hotkeys
are enabled, then numpad hotkeys are enabled too.

This is a folloup for commits a40c8f4 and e89e82e + 8cc0667.
Currently setting (e.g. ctrl [123]) hotkeys for zoom (in/out/reset),
re-enable the default numpad hotkeys (ctrl [+-0]).

Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1791261

Suggested-by: Jakub Janků <jjanku@redhat.com>
Signed-off-by: Uri Lublin <uril@redhat.com>
This commit is contained in:
Uri Lublin 2021-01-10 17:05:09 +02:00 committed by Daniel P. Berrangé
parent b23b53a728
commit 7c442b60b3

View File

@ -905,9 +905,11 @@ virt_viewer_window_enable_modifiers(VirtViewerWindow *self)
"gtk-enable-mnemonics", priv->enable_mnemonics_save,
NULL);
/* if zoom actions using "normal" +/-/0 keys are enabled,
/* if the user did not set hotkeys and
* zoom actions using "normal" +/-/0 keys are enabled,
* allow the user to use the numpad +/-/0 keys as well */
if (gtk_accel_map_lookup_entry("<virt-viewer>/view/zoom-out", &key)
if (!virt_viewer_app_get_enable_accel(priv->app)
&& gtk_accel_map_lookup_entry("<virt-viewer>/view/zoom-out", &key)
&& key.accel_key != 0) {
g_action_map_add_action_entries(G_ACTION_MAP(priv->window),
keypad_action_entries, G_N_ELEMENTS(keypad_action_entries),