diff --git a/SOURCES/0004-ovirt-Do-not-filter-out-DATA-storage-domains.patch b/SOURCES/0004-ovirt-Do-not-filter-out-DATA-storage-domains.patch new file mode 100644 index 0000000..285715a --- /dev/null +++ b/SOURCES/0004-ovirt-Do-not-filter-out-DATA-storage-domains.patch @@ -0,0 +1,38 @@ +From 21b482e6b85df7dca46e1dc8501b0f28ce4570a1 Mon Sep 17 00:00:00 2001 +From: "Eduardo Lima (Etrunko)" +Date: Fri, 15 May 2020 10:24:08 -0300 +Subject: [PATCH virt-viewer] ovirt: Do not filter out DATA storage domains + +Since ovirt 4.2 it is acceptable to have ISO images in storage domains +of DATA type, while the usage of ISO type is about to be deprecated. The +code now allow both types of storage domains when looking up for ISO +images. + +https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.2/html/release_notes/deprecated_features_rhv +https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.4-beta/html/release_notes/deprecated_features_rhv + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1835640 + +Signed-off-by: Eduardo Lima (Etrunko) +--- + src/ovirt-foreign-menu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c +index dc6ecf4..c31c93f 100644 +--- a/src/ovirt-foreign-menu.c ++++ b/src/ovirt-foreign-menu.c +@@ -661,8 +661,8 @@ static gboolean storage_domain_validate(OvirtForeignMenu *menu G_GNUC_UNUSED, + + g_object_get(domain, "name", &name, "type", &type, "state", &state, NULL); + +- if (type != OVIRT_STORAGE_DOMAIN_TYPE_ISO) { +- g_debug("Storage domain '%s' type is not ISO", name); ++ if (type != OVIRT_STORAGE_DOMAIN_TYPE_ISO && type != OVIRT_STORAGE_DOMAIN_TYPE_DATA) { ++ g_debug("Storage domain '%s' type is not ISO or DATA", name); + ret = FALSE; + } + +-- +2.26.2 + diff --git a/SOURCES/0006-ovirt-foreign-menu-Use-proper-function-in-the-case-o.patch b/SOURCES/0006-ovirt-foreign-menu-Use-proper-function-in-the-case-o.patch new file mode 100644 index 0000000..4fce592 --- /dev/null +++ b/SOURCES/0006-ovirt-foreign-menu-Use-proper-function-in-the-case-o.patch @@ -0,0 +1,103 @@ +From 0a16fd513034c2a1475ed84b38461faea7a12250 Mon Sep 17 00:00:00 2001 +From: "Eduardo Lima (Etrunko)" +Date: Thu, 25 Jun 2020 21:19:32 -0300 +Subject: [PATCH virt-viewer] ovirt-foreign-menu: Use proper function in the + case of DATA StorageDomains + +Unlike the StorageDomain objects of ISO type, the DATA ones require a +specific API recently added to libgovirt to support them. This commit +makes use of those new functions under #ifdef guards and adds proper a +check to configure.ac. + +Related: https://bugzilla.redhat.com/show_bug.cgi?id=1847223 + +Signed-off-by: Eduardo Lima (Etrunko) +--- + configure.ac | 2 +- + src/ovirt-foreign-menu.c | 36 ++++++++++++++++++++++++++++++++++-- + 2 files changed, 35 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 9da056f..a313ce1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -203,7 +203,7 @@ AS_IF([test "x$with_ovirt" = "xyes"], + SAVED_LIBS="$LIBS" + CFLAGS="$SAVED_CFLAGS $OVIRT_CFLAGS" + LIBS="$SAVED_LIBS $OVIRT_LIBS" +- AC_CHECK_FUNCS([ovirt_api_search_vms ovirt_vm_get_host ovirt_host_get_cluster ovirt_cluster_get_data_center], ++ AC_CHECK_FUNCS([ovirt_api_search_vms ovirt_vm_get_host ovirt_host_get_cluster ovirt_cluster_get_data_center ovirt_storage_domain_get_disks], + [AC_DEFINE([HAVE_OVIRT_DATA_CENTER], 1, [Have support for data center])], + [] + ) +diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c +index c31c93f..3c67f1a 100644 +--- a/src/ovirt-foreign-menu.c ++++ b/src/ovirt-foreign-menu.c +@@ -481,6 +481,18 @@ static void ovirt_foreign_menu_set_files(OvirtForeignMenu *menu, + for (it = files; it != NULL; it = it->next) { + char *name; + g_object_get(it->data, "name", &name, NULL); ++ ++#ifdef HAVE_OVIRT_STORAGE_DOMAIN_GET_DISKS ++ if (OVIRT_IS_DISK(it->data)) { ++ OvirtDiskContentType content_type; ++ g_object_get(it->data, "content-type", &content_type, NULL); ++ if (content_type != OVIRT_DISK_CONTENT_TYPE_ISO) { ++ g_debug("Ignoring %s disk which content-type is not ISO", name); ++ continue; ++ } ++ } ++#endif ++ + /* The oVirt REST API is supposed to have a 'type' node + * associated with file resources , but as of 3.2, this node + * is not present, so we do an extension check instead +@@ -695,6 +707,26 @@ static gboolean ovirt_foreign_menu_set_file_collection(OvirtForeignMenu *menu, O + return TRUE; + } + ++static OvirtCollection *storage_domain_get_files(OvirtStorageDomain *domain) ++{ ++ OvirtCollection *files = NULL; ++ OvirtStorageDomainType type; ++ ++ if (domain == NULL) ++ return NULL; ++ ++ g_object_get(domain, "type", &type, NULL); ++ ++ if (type == OVIRT_STORAGE_DOMAIN_TYPE_ISO) ++ files = ovirt_storage_domain_get_files(domain); ++#ifdef HAVE_OVIRT_STORAGE_DOMAIN_GET_DISKS ++ else if (type == OVIRT_STORAGE_DOMAIN_TYPE_DATA) ++ files = ovirt_storage_domain_get_disks(domain); ++#endif ++ ++ return files; ++} ++ + static gboolean set_file_collection_from_toplevel_storage_domain(OvirtForeignMenu *menu, OvirtStorageDomain *domain) + { + gboolean ret = FALSE; +@@ -716,7 +748,7 @@ static gboolean set_file_collection_from_toplevel_storage_domain(OvirtForeignMen + goto end; + } + +- ret = ovirt_foreign_menu_set_file_collection(menu, ovirt_storage_domain_get_files(OVIRT_STORAGE_DOMAIN(resource))); ++ ret = ovirt_foreign_menu_set_file_collection(menu, storage_domain_get_files(OVIRT_STORAGE_DOMAIN(resource))); + + end: + g_clear_error(&error); +@@ -756,7 +788,7 @@ static void storage_domains_fetched_cb(GObject *source_object, + if (!domain_valid) + domain_valid = TRUE; + +- file_collection = ovirt_storage_domain_get_files(domain); ++ file_collection = storage_domain_get_files(domain); + if (!ovirt_foreign_menu_set_file_collection(menu, file_collection)) { + /* Retry with toplevel storage domain */ + if (!set_file_collection_from_toplevel_storage_domain(menu, domain)) +-- +2.26.2 + diff --git a/SOURCES/0007-ovirt-foreign-menu-Take-into-account-StorageDomains-.patch b/SOURCES/0007-ovirt-foreign-menu-Take-into-account-StorageDomains-.patch new file mode 100644 index 0000000..402744f --- /dev/null +++ b/SOURCES/0007-ovirt-foreign-menu-Take-into-account-StorageDomains-.patch @@ -0,0 +1,99 @@ +From f5936a87795dfdefee10f87672abcf8f9175a7c9 Mon Sep 17 00:00:00 2001 +From: "Eduardo Lima (Etrunko)" +Date: Mon, 15 Jun 2020 20:53:18 -0300 +Subject: [PATCH virt-viewer] ovirt-foreign-menu: Take into account + StorageDomains of type DATA + +Now that we support both ISO and DATA storage domain types, we need to +make sure that the files are listed correctly. In this case we give the +domains of ISO type the precedence over DATA ones. + +This change extends previous commit bbda3aa which made it possible for +storage domains of type DATA to be considered valid. + +Signed-off-by: Eduardo Lima (Etrunko) +--- + src/ovirt-foreign-menu.c | 39 ++++++++++++++++++++++----------------- + 1 file changed, 22 insertions(+), 17 deletions(-) + +diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c +index 3c67f1a..8d02a79 100644 +--- a/src/ovirt-foreign-menu.c ++++ b/src/ovirt-foreign-menu.c +@@ -734,6 +734,9 @@ static gboolean set_file_collection_from_toplevel_storage_domain(OvirtForeignMen + OvirtResource *resource = NULL; + gchar *href = NULL, *id = NULL; + ++ if (domain == NULL) ++ return FALSE; ++ + g_object_get(domain, "guid", &id, NULL); + href = g_strdup_printf("/ovirt-engine/api/storagedomains/%s", id); + resource = g_initable_new(OVIRT_TYPE_STORAGE_DOMAIN, NULL, &error, "guid", id, "href", href, NULL); +@@ -767,8 +770,8 @@ static void storage_domains_fetched_cb(GObject *source_object, + OvirtForeignMenu *menu = OVIRT_FOREIGN_MENU(g_task_get_source_object(task)); + OvirtCollection *collection = OVIRT_COLLECTION(source_object); + GHashTableIter iter; +- OvirtStorageDomain *domain; +- gboolean domain_valid = FALSE; ++ OvirtStorageDomain *domain, *valid_domain = NULL; ++ OvirtCollection *file_collection; + + ovirt_collection_fetch_finish(collection, result, &error); + if (error != NULL) { +@@ -780,35 +783,37 @@ static void storage_domains_fetched_cb(GObject *source_object, + + g_hash_table_iter_init(&iter, ovirt_collection_get_resources(collection)); + while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&domain)) { +- OvirtCollection *file_collection; +- + if (!storage_domain_validate(menu, domain)) + continue; + +- if (!domain_valid) +- domain_valid = TRUE; ++ /* Storage domain of type ISO has precedence over type DATA */ ++ if (valid_domain != NULL) { ++ OvirtStorageDomainType domain_type, valid_type; ++ g_object_get(domain, "type", &domain_type, NULL); ++ g_object_get(valid_domain, "type", &valid_type, NULL); + +- file_collection = storage_domain_get_files(domain); +- if (!ovirt_foreign_menu_set_file_collection(menu, file_collection)) { +- /* Retry with toplevel storage domain */ +- if (!set_file_collection_from_toplevel_storage_domain(menu, domain)) +- continue; ++ if (domain_type > valid_type) ++ valid_domain = domain; ++ ++ continue; + } + +- break; /* There can only be one valid storage domain at a time, +- no need to iterate more on the list */ ++ valid_domain = domain; + } + +- if (menu->priv->files != NULL) { +- ovirt_foreign_menu_next_async_step(menu, task, STATE_STORAGE_DOMAIN); +- } else { +- const char *msg = domain_valid ? "Could not find ISO file collection" ++ file_collection = storage_domain_get_files(valid_domain); ++ if (!ovirt_foreign_menu_set_file_collection(menu, file_collection) && ++ !set_file_collection_from_toplevel_storage_domain(menu, valid_domain)) { /* Retry with toplevel storage domain */ ++ const char *msg = valid_domain ? "Could not find ISO file collection" + : "Could not find valid ISO storage domain"; + + g_debug("%s", msg); + g_task_return_new_error(task, OVIRT_ERROR, OVIRT_ERROR_FAILED, "%s", msg); + g_object_unref(task); ++ return; + } ++ ++ ovirt_foreign_menu_next_async_step(menu, task, STATE_STORAGE_DOMAIN); + } + + +-- +2.26.2 + diff --git a/SOURCES/0015-windows-fix-nonuniform-behavior-of-zoom-hotkeys.patch b/SOURCES/0015-windows-fix-nonuniform-behavior-of-zoom-hotkeys.patch new file mode 100644 index 0000000..fe7738e --- /dev/null +++ b/SOURCES/0015-windows-fix-nonuniform-behavior-of-zoom-hotkeys.patch @@ -0,0 +1,71 @@ +From a40c8f4508e96c29ea5a24042906d5ded90241fb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20Jank=C5=AF?= +Date: Thu, 3 Dec 2020 13:40:33 +0100 +Subject: [PATCH] windows: fix nonuniform behavior of zoom hotkeys +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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ů +--- + src/virt-viewer-window.c | 24 +++++++++++++++--------- + 1 file changed, 15 insertions(+), 9 deletions(-) + +diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c +index eed3086..5647023 100644 +--- a/src/virt-viewer-window.c ++++ b/src/virt-viewer-window.c +@@ -887,6 +887,7 @@ virt_viewer_window_enable_modifiers(VirtViewerWindow *self) + VirtViewerWindowPrivate *priv = self->priv; + GSList *accels; + guint i; ++ GtkAccelKey key; + + if (priv->accel_enabled) + return; +@@ -904,15 +905,20 @@ virt_viewer_window_enable_modifiers(VirtViewerWindow *self) + "gtk-enable-mnemonics", priv->enable_mnemonics_save, + NULL); + +- g_action_map_add_action_entries(G_ACTION_MAP(priv->window), +- keypad_action_entries, G_N_ELEMENTS(keypad_action_entries), +- self); +- for (i = 0; i < G_N_ELEMENTS(keypad_action_entries); i++) { +- 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); ++ /* if 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("/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), ++ self); ++ for (i = 0; i < G_N_ELEMENTS(keypad_action_entries); i++) { ++ 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; +-- +2.29.2 + diff --git a/SOURCES/0016-hotkeys-enable-setting-zoom-hotkeys-from-command-lin.patch b/SOURCES/0016-hotkeys-enable-setting-zoom-hotkeys-from-command-lin.patch new file mode 100644 index 0000000..80ccb1b --- /dev/null +++ b/SOURCES/0016-hotkeys-enable-setting-zoom-hotkeys-from-command-lin.patch @@ -0,0 +1,30 @@ +From e89e82eeb9a917f077720d4821c0e306a6d130d1 Mon Sep 17 00:00:00 2001 +From: Uri Lublin +Date: Tue, 8 Dec 2020 19:50:01 +0200 +Subject: [PATCH 16/19] hotkeys: enable setting zoom hotkeys from command line + +Signed-off-by: Uri Lublin +--- + src/virt-viewer-app.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c +index 3ee5990..8d795ca 100644 +--- a/src/virt-viewer-app.c ++++ b/src/virt-viewer-app.c +@@ -2511,6 +2511,12 @@ virt_viewer_app_set_hotkeys(VirtViewerApp *self, const gchar *hotkeys_str) + status = gtk_accel_map_change_entry("/view/toggle-fullscreen", accel_key, accel_mods, TRUE); + } else if (g_str_equal(*hotkey, "release-cursor")) { + status = gtk_accel_map_change_entry("/view/release-cursor", accel_key, accel_mods, TRUE); ++ } else if (g_str_equal(*hotkey, "zoom-reset")) { ++ status = gtk_accel_map_change_entry("/view/zoom-reset", accel_key, accel_mods, TRUE); ++ } else if (g_str_equal(*hotkey, "zoom-out")) { ++ status = gtk_accel_map_change_entry("/view/zoom-out", accel_key, accel_mods, TRUE); ++ } else if (g_str_equal(*hotkey, "zoom-in")) { ++ status = gtk_accel_map_change_entry("/view/zoom-in", accel_key, accel_mods, TRUE); + } else if (g_str_equal(*hotkey, "secure-attention")) { + status = gtk_accel_map_change_entry("/send/secure-attention", accel_key, accel_mods, TRUE); + } else if (g_str_equal(*hotkey, "smartcard-insert")) { +-- +2.29.2 + diff --git a/SOURCES/0017-hotkeys-enable-setting-zoom-hotkeys-from-a-vv-file.patch b/SOURCES/0017-hotkeys-enable-setting-zoom-hotkeys-from-a-vv-file.patch new file mode 100644 index 0000000..9757f41 --- /dev/null +++ b/SOURCES/0017-hotkeys-enable-setting-zoom-hotkeys-from-a-vv-file.patch @@ -0,0 +1,164 @@ +From 8cc06670239ae382a3b2e17fe39f5ecfb7bfe2f9 Mon Sep 17 00:00:00 2001 +From: Uri Lublin +Date: Tue, 8 Dec 2020 19:50:57 +0200 +Subject: [PATCH 17/19] hotkeys: enable setting zoom hotkeys from a vv file + +Signed-off-by: Uri Lublin +--- + src/virt-viewer-file.c | 79 ++++++++++++++++++++++++++++++++++++++++++ + src/virt-viewer-file.h | 7 ++++ + 2 files changed, 86 insertions(+) + +diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c +index 7d2b2cb..143074f 100644 +--- a/src/virt-viewer-file.c ++++ b/src/virt-viewer-file.c +@@ -57,6 +57,9 @@ + * - title: string + * - toggle-fullscreen: string in spice hotkey format + * - release-cursor: string in spice hotkey format ++ * - zoom-in: zoom in and make the client window larger ++ * - zoom-out: zoom out and make the client window smaller ++ * - zoom-reset: reset zoom and client window size + * - smartcard-insert: string in spice hotkey format + * - smartcard-remove: string in spice hotkey format + * - secure-attention: string in spice hotkey format +@@ -117,6 +120,9 @@ enum { + PROP_TITLE, + PROP_TOGGLE_FULLSCREEN, + PROP_RELEASE_CURSOR, ++ PROP_ZOOM_IN, ++ PROP_ZOOM_OUT, ++ PROP_ZOOM_RESET, + PROP_ENABLE_SMARTCARD, + PROP_ENABLE_USBREDIR, + PROP_COLOR_DEPTH, +@@ -514,6 +520,46 @@ virt_viewer_file_set_release_cursor(VirtViewerFile* self, const gchar* value) + g_object_notify(G_OBJECT(self), "release-cursor"); + } + ++gchar* ++virt_viewer_file_get_zoom_in(VirtViewerFile* self) ++{ ++ return virt_viewer_file_get_string(self, MAIN_GROUP, "zoom-in"); ++} ++ ++void ++virt_viewer_file_set_zoom_in(VirtViewerFile* self, const gchar* value) ++{ ++ virt_viewer_file_set_string(self, MAIN_GROUP, "zoom-in", value); ++ g_object_notify(G_OBJECT(self), "zoom-in"); ++} ++ ++gchar* ++virt_viewer_file_get_zoom_out(VirtViewerFile* self) ++{ ++ return virt_viewer_file_get_string(self, MAIN_GROUP, "zoom-out"); ++} ++ ++void ++virt_viewer_file_set_zoom_out(VirtViewerFile* self, const gchar* value) ++{ ++ virt_viewer_file_set_string(self, MAIN_GROUP, "zoom-out", value); ++ g_object_notify(G_OBJECT(self), "zoom-out"); ++} ++ ++gchar* ++virt_viewer_file_get_zoom_reset(VirtViewerFile* self) ++{ ++ return virt_viewer_file_get_string(self, MAIN_GROUP, "zoom-reset"); ++} ++ ++void ++virt_viewer_file_set_zoom_reset(VirtViewerFile* self, const gchar* value) ++{ ++ virt_viewer_file_set_string(self, MAIN_GROUP, "zoom-reset", value); ++ g_object_notify(G_OBJECT(self), "zoom-reset"); ++} ++ ++ + gchar* + virt_viewer_file_get_secure_attention(VirtViewerFile* self) + { +@@ -917,6 +963,9 @@ virt_viewer_file_fill_app(VirtViewerFile* self, VirtViewerApp *app, GError **err + } accels[] = { + { "release-cursor", "/view/release-cursor" }, + { "toggle-fullscreen", "/view/toggle-fullscreen" }, ++ { "zoom-in", "/view/zoom-in" }, ++ { "zoom-out", "/view/zoom-out" }, ++ { "zoom-reset", "/view/zoom-reset" }, + { "smartcard-insert", "/file/smartcard-insert" }, + { "smartcard-remove", "/file/smartcard-remove" }, + { "secure-attention", "/send/secure-attention" } +@@ -995,6 +1044,15 @@ virt_viewer_file_set_property(GObject* object, guint property_id, + case PROP_RELEASE_CURSOR: + virt_viewer_file_set_release_cursor(self, g_value_get_string(value)); + break; ++ case PROP_ZOOM_IN: ++ virt_viewer_file_set_zoom_in(self, g_value_get_string(value)); ++ break; ++ case PROP_ZOOM_OUT: ++ virt_viewer_file_set_zoom_out(self, g_value_get_string(value)); ++ break; ++ case PROP_ZOOM_RESET: ++ virt_viewer_file_set_zoom_reset(self, g_value_get_string(value)); ++ break; + case PROP_SECURE_ATTENTION: + virt_viewer_file_set_secure_attention(self, g_value_get_string(value)); + break; +@@ -1112,6 +1170,15 @@ virt_viewer_file_get_property(GObject* object, guint property_id, + case PROP_RELEASE_CURSOR: + g_value_take_string(value, virt_viewer_file_get_release_cursor(self)); + break; ++ case PROP_ZOOM_IN: ++ g_value_take_string(value, virt_viewer_file_get_zoom_in(self)); ++ break; ++ case PROP_ZOOM_OUT: ++ g_value_take_string(value, virt_viewer_file_get_zoom_out(self)); ++ break; ++ case PROP_ZOOM_RESET: ++ g_value_take_string(value, virt_viewer_file_get_zoom_reset(self)); ++ break; + case PROP_SECURE_ATTENTION: + g_value_take_string(value, virt_viewer_file_get_secure_attention(self)); + break; +@@ -1255,6 +1322,18 @@ virt_viewer_file_class_init(VirtViewerFileClass* klass) + g_param_spec_string("release-cursor", "release-cursor", "release-cursor", NULL, + G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); + ++ g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_ZOOM_IN, ++ g_param_spec_string("zoom-in", "zoom-in", "zoom-in", NULL, ++ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); ++ ++ g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_ZOOM_OUT, ++ g_param_spec_string("zoom-out", "zoom-out", "zoom-out", NULL, ++ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); ++ ++ g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_ZOOM_RESET, ++ g_param_spec_string("zoom-reset", "zoom-reset", "zoom-reset", NULL, ++ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); ++ + g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_SECURE_ATTENTION, + g_param_spec_string("secure-attention", "secure-attention", "secure-attention", NULL, + G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); +diff --git a/src/virt-viewer-file.h b/src/virt-viewer-file.h +index 108bcbf..b0aef6d 100644 +--- a/src/virt-viewer-file.h ++++ b/src/virt-viewer-file.h +@@ -86,6 +86,13 @@ gchar* virt_viewer_file_get_toggle_fullscreen(VirtViewerFile* self); + void virt_viewer_file_set_toggle_fullscreen(VirtViewerFile* self, const gchar* value); + gchar* virt_viewer_file_get_release_cursor(VirtViewerFile* self); + void virt_viewer_file_set_release_cursor(VirtViewerFile* self, const gchar* value); ++gchar* virt_viewer_file_get_zoom_in(VirtViewerFile* self); ++void virt_viewer_file_set_zoom_in(VirtViewerFile* self, const gchar* value); ++gchar* virt_viewer_file_get_zoom_out(VirtViewerFile* self); ++void virt_viewer_file_set_zoom_out(VirtViewerFile* self, const gchar* value); ++gchar* virt_viewer_file_get_zoom_reset(VirtViewerFile* self); ++void virt_viewer_file_set_zoom_reset(VirtViewerFile* self, const gchar* value); ++ + gint virt_viewer_file_get_enable_smartcard(VirtViewerFile* self); + void virt_viewer_file_set_enable_smartcard(VirtViewerFile* self, gint value); + gint virt_viewer_file_get_enable_usbredir(VirtViewerFile* self); +-- +2.29.2 + diff --git a/SOURCES/0018-tests-hotkeys-add-zoom-hotkeys.patch b/SOURCES/0018-tests-hotkeys-add-zoom-hotkeys.patch new file mode 100644 index 0000000..fa25991 --- /dev/null +++ b/SOURCES/0018-tests-hotkeys-add-zoom-hotkeys.patch @@ -0,0 +1,25 @@ +From 8de1e49136599842d52823295c0d3f4b941601de Mon Sep 17 00:00:00 2001 +From: Uri Lublin +Date: Tue, 8 Dec 2020 20:11:23 +0200 +Subject: [PATCH 18/19] tests: hotkeys: add zoom hotkeys + +Signed-off-by: Uri Lublin +--- + tests/test-hotkeys.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/test-hotkeys.c b/tests/test-hotkeys.c +index cd2bd88..8275647 100644 +--- a/tests/test-hotkeys.c ++++ b/tests/test-hotkeys.c +@@ -67,6 +67,7 @@ test_hotkeys_good(void) + const gchar *hotkeys[] = { + "toggle-fullscreen=shift+f11", + "release-cursor=shift+f12,secure-attention=ctrl+shift+b", ++ "zoom-in=shift+f2,zoom-out=shift+f3,zoom-reset=shift+f4", + "smartcard-insert=shift+I,smartcard-remove=shift+R", + }; + +-- +2.29.2 + diff --git a/SOURCES/0019-man-add-zoom-hotkeys.patch b/SOURCES/0019-man-add-zoom-hotkeys.patch new file mode 100644 index 0000000..dfb6aea --- /dev/null +++ b/SOURCES/0019-man-add-zoom-hotkeys.patch @@ -0,0 +1,61 @@ +From ae3e15f851605e5551406412fed00a034fc66f58 Mon Sep 17 00:00:00 2001 +From: Uri Lublin +Date: Tue, 8 Dec 2020 20:12:19 +0200 +Subject: [PATCH 19/19] man: add zoom hotkeys + +Signed-off-by: Uri Lublin +--- + man/remote-viewer.pod | 15 ++++++++++++++- + man/virt-viewer.pod | 3 ++- + 2 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/man/remote-viewer.pod b/man/remote-viewer.pod +index 73c829f..e820f4b 100644 +--- a/man/remote-viewer.pod ++++ b/man/remote-viewer.pod +@@ -69,7 +69,8 @@ guest display widget does not have focus. Any actions specified in B + will be effective even when the guest display widget has input focus. The format + for B is =[+][,=[+]]. + Key-names are case-insensitive. Valid actions are: toggle-fullscreen, +-release-cursor, secure-attention, smartcard-insert and smartcard-remove. The ++release-cursor, zoom-in, zoom-out, zoom-reset, ++secure-attention, smartcard-insert and smartcard-remove. The + C action sends a secure attention sequence (Ctrl+Alt+Del) to + the guest. Examples: + +@@ -224,6 +225,18 @@ Key binding for entering and leaving fullscreen mode. (see L for descrip + + Key binding for releasing cursor grab. (see L for description of expected string) + ++=item C (hotkey string) ++ ++Key binding for zooming in and enlarging client window size. (see L for description of expected string) ++ ++=item C (hotkey string) ++ ++Key binding for zooming out and reducing client window size. (see L for description of expected string) ++ ++=item C (hotkey string) ++ ++Key binding for reseting zoom and client window size. (see L for description of expected string) ++ + =item C (hotkey string) + + Key binding for inserting emulated smartcard. (see L for description of expected string) +diff --git a/man/virt-viewer.pod b/man/virt-viewer.pod +index d55c5be..a42134b 100644 +--- a/man/virt-viewer.pod ++++ b/man/virt-viewer.pod +@@ -89,7 +89,8 @@ guest display widget does not have focus. Any actions specified in B + will be effective even when the guest display widget has input focus. The format + for B is =[+][,=[+]]. + Key-names are case-insensitive. Valid actions are: toggle-fullscreen, +-release-cursor, secure-attention, smartcard-insert and smartcard-remove. The ++release-cursor, zoom-in, zoom-out, zoom-reset, ++secure-attention, smartcard-insert and smartcard-remove. The + C action sends a secure attention sequence (Ctrl+Alt+Del) to + the guest. Examples: + +-- +2.29.2 + diff --git a/SOURCES/0020-zoom-hotkeys-disable-numpad-when-users-set-new-hotke.patch b/SOURCES/0020-zoom-hotkeys-disable-numpad-when-users-set-new-hotke.patch new file mode 100644 index 0000000..9f738fa --- /dev/null +++ b/SOURCES/0020-zoom-hotkeys-disable-numpad-when-users-set-new-hotke.patch @@ -0,0 +1,45 @@ +From a0f227c723d424c6f1cf63efa213668e69800e98 Mon Sep 17 00:00:00 2001 +From: Uri Lublin +Date: Sun, 10 Jan 2021 17:05:09 +0200 +Subject: [PATCH] zoom hotkeys: disable numpad when users set new hotkeys +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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ů +Signed-off-by: Uri Lublin +--- + src/virt-viewer-window.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c +index 5647023..448ef74 100644 +--- a/src/virt-viewer-window.c ++++ b/src/virt-viewer-window.c +@@ -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("/view/zoom-out", &key) ++ if (!virt_viewer_app_get_enable_accel(priv->app) ++ && gtk_accel_map_lookup_entry("/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), +-- +2.29.2 + diff --git a/SOURCES/0021-disable-default-grab-sequence-in-kiosk-mode.patch b/SOURCES/0021-disable-default-grab-sequence-in-kiosk-mode.patch new file mode 100644 index 0000000..91450f4 --- /dev/null +++ b/SOURCES/0021-disable-default-grab-sequence-in-kiosk-mode.patch @@ -0,0 +1,70 @@ +From c3a3f23968edceaf097f20450c795c762ec36fc0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20Jank=C5=AF?= +Date: Sun, 20 Dec 2020 12:29:27 +0100 +Subject: [PATCH] disable default grab sequence in kiosk mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Hotkeys should be disabled in kiosk mode. However, if no +"release-cursor" hotkey is specified, the default Ctrl+Alt +grab sequence keeps functioning even in kiosk mode. +That's because it's based on the spice/vnc functionality instead +of on the accelerators in virt-viewer. + +That's especially problematic with spice, because the grab +sequence releases both the cursor and the keyboard. Thus the user +can escape from kiosk mode by pressing Ctrl+Alt followed by +Alt+Tab, for example. + +Related: https://bugzilla.redhat.com/show_bug.cgi?id=1893584 + +Signed-off-by: Jakub Janků +--- + src/virt-viewer-display-spice.c | 6 +++++- + src/virt-viewer-display-vnc.c | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c +index a82422c..799403c 100644 +--- a/src/virt-viewer-display-spice.c ++++ b/src/virt-viewer-display-spice.c +@@ -238,10 +238,14 @@ enable_accel_changed(VirtViewerApp *app, + VirtViewerDisplaySpice *self) + { + GtkAccelKey key = {0, 0, 0}; ++ gboolean kiosk; ++ + if (virt_viewer_app_get_enable_accel(app)) + gtk_accel_map_lookup_entry("/view/release-cursor", &key); + +- if (key.accel_key || key.accel_mods) { ++ g_object_get(app, "kiosk", &kiosk, NULL); ++ ++ if (key.accel_key || key.accel_mods || kiosk) { + SpiceGrabSequence *seq = spice_grab_sequence_new(0, NULL); + /* disable default grab sequence */ + spice_display_set_grab_keys(self->priv->display, seq); +diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c +index d38dcac..537173c 100644 +--- a/src/virt-viewer-display-vnc.c ++++ b/src/virt-viewer-display-vnc.c +@@ -188,10 +188,14 @@ enable_accel_changed(VirtViewerApp *app, + VncDisplay *vnc) + { + GtkAccelKey key = {0, 0, 0}; ++ gboolean kiosk; ++ + if (virt_viewer_app_get_enable_accel(app)) + gtk_accel_map_lookup_entry("/view/release-cursor", &key); + +- if (key.accel_key || key.accel_mods) { ++ g_object_get(app, "kiosk", &kiosk, NULL); ++ ++ if (key.accel_key || key.accel_mods || kiosk) { + VncGrabSequence *seq = vnc_grab_sequence_new(0, NULL); + /* disable default grab sequence */ + vnc_display_set_grab_keys(vnc, seq); +-- +2.29.2 + diff --git a/SOURCES/0022-vnc-no-dialog-for-server-closed-connection-error.patch b/SOURCES/0022-vnc-no-dialog-for-server-closed-connection-error.patch new file mode 100644 index 0000000..b6e02c1 --- /dev/null +++ b/SOURCES/0022-vnc-no-dialog-for-server-closed-connection-error.patch @@ -0,0 +1,62 @@ +From 74fdd26c949847bca41c7ca71bc88d30d92d92aa Mon Sep 17 00:00:00 2001 +From: Uri Lublin +Date: Sun, 17 Jan 2021 19:25:57 +0200 +Subject: [PATCH] vnc: no dialog for server-closed-connection error + +Following commit de5cd71, when the server closes the connection +(likely when qemu-kvm exits), a dialog is shown to the user. + +This behavior change is not good for automatic tests that expect +virt-viewer to exit without any dialog. + +This patch makes sure no dialog is shown for this error, by +checking if the VNC connection was already initialized. + +Signed-off-by: Uri Lublin +--- + src/virt-viewer-app.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c +index 8d795ca..4a579f8 100644 +--- a/src/virt-viewer-app.c ++++ b/src/virt-viewer-app.c +@@ -139,6 +139,7 @@ struct _VirtViewerAppPrivate { + gboolean kiosk; + gboolean vm_ui; + gboolean vm_running; ++ gboolean initialized; + + VirtViewerSession *session; + gboolean active; +@@ -1651,6 +1652,7 @@ virt_viewer_app_deactivate(VirtViewerApp *self, gboolean connect_error) + virt_viewer_session_close(VIRT_VIEWER_SESSION(priv->session)); + } + ++ priv->initialized = FALSE; + priv->connected = FALSE; + priv->active = FALSE; + priv->started = FALSE; +@@ -1689,6 +1691,7 @@ static void + virt_viewer_app_initialized(VirtViewerSession *session G_GNUC_UNUSED, + VirtViewerApp *self) + { ++ self->priv->initialized = TRUE; + virt_viewer_app_update_title(self); + } + +@@ -1727,7 +1730,10 @@ virt_viewer_app_error(VirtViewerSession *session G_GNUC_UNUSED, + { + VirtViewerAppPrivate *priv = self->priv; + +- priv->connected = FALSE; /* display error dialog */ ++ /* Do not open a dialog if the connection was initialized ++ * This happens when the VNC server closes the connection */ ++ if (!priv->initialized) ++ priv->connected = FALSE; /* display error dialog */ + + virt_viewer_app_disconnected(session, msg, self); + } +-- +2.29.2 + diff --git a/SPECS/virt-viewer.spec b/SPECS/virt-viewer.spec index c30fbb3..745749e 100644 --- a/SPECS/virt-viewer.spec +++ b/SPECS/virt-viewer.spec @@ -19,7 +19,7 @@ Name: virt-viewer Version: 9.0 -Release: 5%{?dist}%{?extra_release} +Release: 9%{?dist}%{?extra_release} Summary: Virtual Machine Viewer Group: Applications/System License: GPLv2+ @@ -29,7 +29,10 @@ Source0: http://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar Patch001: 0001-DOWNSTREAM-Workaround-inconsistency-with-REST-API.patch Patch002: 0002-DOWNSTREAM-ovirt-foreign-menu-Bypass-errors-from-Hos.patch Patch003: 0003-DOWNSTREAM-remote-viewer-Set-admin-privileges-when-c.patch +Patch004: 0004-ovirt-Do-not-filter-out-DATA-storage-domains.patch Patch005: 0005-display-error-message-on-no-extension-for-screenshot.patch +Patch006: 0006-ovirt-foreign-menu-Use-proper-function-in-the-case-o.patch +Patch007: 0007-ovirt-foreign-menu-Take-into-account-StorageDomains-.patch #rhbz#1548371 Patch008: 0008-More-specific-key-accelerator-description.patch @@ -45,10 +48,22 @@ Patch012: 0012-ui-about-po-update-pot-file.patch # rhbz#1448151 Patch013: 0013-vnc-show-an-error-dialog-upon-vnc-error.patch +Patch022: 0022-vnc-no-dialog-for-server-closed-connection-error.patch # rhbz#1876719 Patch014: 0014-Fix-warning-by-Coverity.patch +# rhbz#1791261 +Patch015: 0015-windows-fix-nonuniform-behavior-of-zoom-hotkeys.patch +Patch016: 0016-hotkeys-enable-setting-zoom-hotkeys-from-command-lin.patch +Patch017: 0017-hotkeys-enable-setting-zoom-hotkeys-from-a-vv-file.patch +Patch018: 0018-tests-hotkeys-add-zoom-hotkeys.patch +# patch19 slightly modified, no usb-device-reset accel +Patch019: 0019-man-add-zoom-hotkeys.patch +Patch020: 0020-zoom-hotkeys-disable-numpad-when-users-set-new-hotke.patch + +# rhbz#1893584 +Patch021: 0021-disable-default-grab-sequence-in-kiosk-mode.patch Requires: openssh-clients Requires(post): %{_sbindir}/update-alternatives @@ -96,7 +111,10 @@ the display, and libvirt for looking up VNC/SPICE server details. %patch001 -p1 %patch002 -p1 %patch003 -p1 +%patch004 -p1 %patch005 -p1 +%patch006 -p1 +%patch007 -p1 %patch008 -p1 %patch009 -p1 @@ -108,6 +126,16 @@ the display, and libvirt for looking up VNC/SPICE server details. %patch013 -p1 %patch014 -p1 +%patch015 -p1 +%patch016 -p1 +%patch017 -p1 +%patch018 -p1 +%patch019 -p1 +%patch020 -p1 + +%patch021 -p1 +%patch022 -p1 + %build %if 0%{?enable_autotools} @@ -146,6 +174,22 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/remote-viewer.1* %changelog +* Thu Jan 21 2021 Uri Lublin - 9.0-9 +- Show an error dialog upon vnc-error only if session was initialized + Resolves: rhbz#1448151 + +* Mon Jan 18 2021 Uri Lublin - 9.0-8 +- Disable default grab sequence in kiosk mode + Resolves: rhbz#1893584 + +* Mon Jan 11 2021 Uri Lublin - 9.0-7 +- Fix some zoom hotkeys issues + Resolves: rhbz#1791261 + +* Tue Dec 22 2020 Eduardo Lima (Etrunko) - 9.0-6 +- Add back support for DATA storage domains. + Resolves: rhbz#1835640 + * Thu Dec 03 2020 Uri Lublin - 9.0-5 - More specific key accelerator description for cursor release Resolves: rhbz#1548371