mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-27 14:54:14 +00:00
windows: fix nonuniform behavior of zoom hotkeys
If a vv file is used or the hotkeys are customized using the --hotkeys cmd option, all hotkeys that are not explicitly requested get disabled, this includes the zomm hotkeys. As a consequence, the labels for zoom actions in the menu disappear. However, the user can still perform these actions using the keys on the numpad which are handled separately. To fix it, check that the normal zoom hotkeys are enabled before enabling the keypad ones. Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1791261 Signed-off-by: Jakub Janků <jjanku@redhat.com>
This commit is contained in:
parent
d5e96a30cb
commit
a40c8f4508
@ -887,6 +887,7 @@ virt_viewer_window_enable_modifiers(VirtViewerWindow *self)
|
|||||||
VirtViewerWindowPrivate *priv = self->priv;
|
VirtViewerWindowPrivate *priv = self->priv;
|
||||||
GSList *accels;
|
GSList *accels;
|
||||||
guint i;
|
guint i;
|
||||||
|
GtkAccelKey key;
|
||||||
|
|
||||||
if (priv->accel_enabled)
|
if (priv->accel_enabled)
|
||||||
return;
|
return;
|
||||||
@ -904,15 +905,20 @@ virt_viewer_window_enable_modifiers(VirtViewerWindow *self)
|
|||||||
"gtk-enable-mnemonics", priv->enable_mnemonics_save,
|
"gtk-enable-mnemonics", priv->enable_mnemonics_save,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_action_map_add_action_entries(G_ACTION_MAP(priv->window),
|
/* if zoom actions using "normal" +/-/0 keys are enabled,
|
||||||
keypad_action_entries, G_N_ELEMENTS(keypad_action_entries),
|
* allow the user to use the numpad +/-/0 keys as well */
|
||||||
self);
|
if (gtk_accel_map_lookup_entry("<virt-viewer>/view/zoom-out", &key)
|
||||||
for (i = 0; i < G_N_ELEMENTS(keypad_action_entries); i++) {
|
&& key.accel_key != 0) {
|
||||||
gchar *detailed_name = g_strdup_printf("win.%s", keypad_action_entries[i].name);
|
g_action_map_add_action_entries(G_ACTION_MAP(priv->window),
|
||||||
gtk_application_set_accels_for_action(GTK_APPLICATION(priv->app),
|
keypad_action_entries, G_N_ELEMENTS(keypad_action_entries),
|
||||||
detailed_name,
|
self);
|
||||||
keypad_action_accels[i]);
|
for (i = 0; i < G_N_ELEMENTS(keypad_action_entries); i++) {
|
||||||
g_free(detailed_name);
|
gchar *detailed_name = g_strdup_printf("win.%s", keypad_action_entries[i].name);
|
||||||
|
gtk_application_set_accels_for_action(GTK_APPLICATION(priv->app),
|
||||||
|
detailed_name,
|
||||||
|
keypad_action_accels[i]);
|
||||||
|
g_free(detailed_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->accel_enabled = TRUE;
|
priv->accel_enabled = TRUE;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user