Blame SOURCES/0017-hotkeys-enable-setting-zoom-hotkeys-from-a-vv-file.patch

19ccae
From 8cc06670239ae382a3b2e17fe39f5ecfb7bfe2f9 Mon Sep 17 00:00:00 2001
19ccae
From: Uri Lublin <uril@redhat.com>
19ccae
Date: Tue, 8 Dec 2020 19:50:57 +0200
19ccae
Subject: [PATCH 17/19] hotkeys: enable setting zoom hotkeys from a vv file
19ccae
19ccae
Signed-off-by: Uri Lublin <uril@redhat.com>
19ccae
---
19ccae
 src/virt-viewer-file.c | 79 ++++++++++++++++++++++++++++++++++++++++++
19ccae
 src/virt-viewer-file.h |  7 ++++
19ccae
 2 files changed, 86 insertions(+)
19ccae
19ccae
diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c
19ccae
index 7d2b2cb..143074f 100644
19ccae
--- a/src/virt-viewer-file.c
19ccae
+++ b/src/virt-viewer-file.c
19ccae
@@ -57,6 +57,9 @@
19ccae
  * - title: string
19ccae
  * - toggle-fullscreen: string in spice hotkey format
19ccae
  * - release-cursor: string in spice hotkey format
19ccae
+ * - zoom-in: zoom in and make the client window larger
19ccae
+ * - zoom-out: zoom out and make the client window smaller
19ccae
+ * - zoom-reset: reset zoom and client window size
19ccae
  * - smartcard-insert: string in spice hotkey format
19ccae
  * - smartcard-remove: string in spice hotkey format
19ccae
  * - secure-attention: string in spice hotkey format
19ccae
@@ -117,6 +120,9 @@ enum  {
19ccae
     PROP_TITLE,
19ccae
     PROP_TOGGLE_FULLSCREEN,
19ccae
     PROP_RELEASE_CURSOR,
19ccae
+    PROP_ZOOM_IN,
19ccae
+    PROP_ZOOM_OUT,
19ccae
+    PROP_ZOOM_RESET,
19ccae
     PROP_ENABLE_SMARTCARD,
19ccae
     PROP_ENABLE_USBREDIR,
19ccae
     PROP_COLOR_DEPTH,
19ccae
@@ -514,6 +520,46 @@ virt_viewer_file_set_release_cursor(VirtViewerFile* self, const gchar* value)
19ccae
     g_object_notify(G_OBJECT(self), "release-cursor");
19ccae
 }
19ccae
 
19ccae
+gchar*
19ccae
+virt_viewer_file_get_zoom_in(VirtViewerFile* self)
19ccae
+{
19ccae
+    return virt_viewer_file_get_string(self, MAIN_GROUP, "zoom-in");
19ccae
+}
19ccae
+
19ccae
+void
19ccae
+virt_viewer_file_set_zoom_in(VirtViewerFile* self, const gchar* value)
19ccae
+{
19ccae
+    virt_viewer_file_set_string(self, MAIN_GROUP, "zoom-in", value);
19ccae
+    g_object_notify(G_OBJECT(self), "zoom-in");
19ccae
+}
19ccae
+
19ccae
+gchar*
19ccae
+virt_viewer_file_get_zoom_out(VirtViewerFile* self)
19ccae
+{
19ccae
+    return virt_viewer_file_get_string(self, MAIN_GROUP, "zoom-out");
19ccae
+}
19ccae
+
19ccae
+void
19ccae
+virt_viewer_file_set_zoom_out(VirtViewerFile* self, const gchar* value)
19ccae
+{
19ccae
+    virt_viewer_file_set_string(self, MAIN_GROUP, "zoom-out", value);
19ccae
+    g_object_notify(G_OBJECT(self), "zoom-out");
19ccae
+}
19ccae
+
19ccae
+gchar*
19ccae
+virt_viewer_file_get_zoom_reset(VirtViewerFile* self)
19ccae
+{
19ccae
+    return virt_viewer_file_get_string(self, MAIN_GROUP, "zoom-reset");
19ccae
+}
19ccae
+
19ccae
+void
19ccae
+virt_viewer_file_set_zoom_reset(VirtViewerFile* self, const gchar* value)
19ccae
+{
19ccae
+    virt_viewer_file_set_string(self, MAIN_GROUP, "zoom-reset", value);
19ccae
+    g_object_notify(G_OBJECT(self), "zoom-reset");
19ccae
+}
19ccae
+
19ccae
+
19ccae
 gchar*
19ccae
 virt_viewer_file_get_secure_attention(VirtViewerFile* self)
19ccae
 {
19ccae
@@ -917,6 +963,9 @@ virt_viewer_file_fill_app(VirtViewerFile* self, VirtViewerApp *app, GError **err
19ccae
         } accels[] = {
19ccae
             { "release-cursor", "<virt-viewer>/view/release-cursor" },
19ccae
             { "toggle-fullscreen", "<virt-viewer>/view/toggle-fullscreen" },
19ccae
+            { "zoom-in", "<virt-viewer>/view/zoom-in" },
19ccae
+            { "zoom-out", "<virt-viewer>/view/zoom-out" },
19ccae
+            { "zoom-reset", "<virt-viewer>/view/zoom-reset" },
19ccae
             { "smartcard-insert", "<virt-viewer>/file/smartcard-insert" },
19ccae
             { "smartcard-remove", "<virt-viewer>/file/smartcard-remove" },
19ccae
             { "secure-attention", "<virt-viewer>/send/secure-attention" }
19ccae
@@ -995,6 +1044,15 @@ virt_viewer_file_set_property(GObject* object, guint property_id,
19ccae
     case PROP_RELEASE_CURSOR:
19ccae
         virt_viewer_file_set_release_cursor(self, g_value_get_string(value));
19ccae
         break;
19ccae
+    case PROP_ZOOM_IN:
19ccae
+        virt_viewer_file_set_zoom_in(self, g_value_get_string(value));
19ccae
+        break;
19ccae
+    case PROP_ZOOM_OUT:
19ccae
+        virt_viewer_file_set_zoom_out(self, g_value_get_string(value));
19ccae
+        break;
19ccae
+    case PROP_ZOOM_RESET:
19ccae
+        virt_viewer_file_set_zoom_reset(self, g_value_get_string(value));
19ccae
+        break;
19ccae
     case PROP_SECURE_ATTENTION:
19ccae
         virt_viewer_file_set_secure_attention(self, g_value_get_string(value));
19ccae
         break;
19ccae
@@ -1112,6 +1170,15 @@ virt_viewer_file_get_property(GObject* object, guint property_id,
19ccae
     case PROP_RELEASE_CURSOR:
19ccae
         g_value_take_string(value, virt_viewer_file_get_release_cursor(self));
19ccae
         break;
19ccae
+    case PROP_ZOOM_IN:
19ccae
+        g_value_take_string(value, virt_viewer_file_get_zoom_in(self));
19ccae
+        break;
19ccae
+    case PROP_ZOOM_OUT:
19ccae
+        g_value_take_string(value, virt_viewer_file_get_zoom_out(self));
19ccae
+        break;
19ccae
+    case PROP_ZOOM_RESET:
19ccae
+        g_value_take_string(value, virt_viewer_file_get_zoom_reset(self));
19ccae
+        break;
19ccae
     case PROP_SECURE_ATTENTION:
19ccae
         g_value_take_string(value, virt_viewer_file_get_secure_attention(self));
19ccae
         break;
19ccae
@@ -1255,6 +1322,18 @@ virt_viewer_file_class_init(VirtViewerFileClass* klass)
19ccae
         g_param_spec_string("release-cursor", "release-cursor", "release-cursor", NULL,
19ccae
                             G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
19ccae
 
19ccae
+    g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_ZOOM_IN,
19ccae
+        g_param_spec_string("zoom-in", "zoom-in", "zoom-in", NULL,
19ccae
+                            G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
19ccae
+
19ccae
+    g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_ZOOM_OUT,
19ccae
+        g_param_spec_string("zoom-out", "zoom-out", "zoom-out", NULL,
19ccae
+                            G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
19ccae
+
19ccae
+    g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_ZOOM_RESET,
19ccae
+        g_param_spec_string("zoom-reset", "zoom-reset", "zoom-reset", NULL,
19ccae
+                            G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
19ccae
+
19ccae
     g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_SECURE_ATTENTION,
19ccae
         g_param_spec_string("secure-attention", "secure-attention", "secure-attention", NULL,
19ccae
                             G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
19ccae
diff --git a/src/virt-viewer-file.h b/src/virt-viewer-file.h
19ccae
index 108bcbf..b0aef6d 100644
19ccae
--- a/src/virt-viewer-file.h
19ccae
+++ b/src/virt-viewer-file.h
19ccae
@@ -86,6 +86,13 @@ gchar* virt_viewer_file_get_toggle_fullscreen(VirtViewerFile* self);
19ccae
 void virt_viewer_file_set_toggle_fullscreen(VirtViewerFile* self, const gchar* value);
19ccae
 gchar* virt_viewer_file_get_release_cursor(VirtViewerFile* self);
19ccae
 void virt_viewer_file_set_release_cursor(VirtViewerFile* self, const gchar* value);
19ccae
+gchar* virt_viewer_file_get_zoom_in(VirtViewerFile* self);
19ccae
+void virt_viewer_file_set_zoom_in(VirtViewerFile* self, const gchar* value);
19ccae
+gchar* virt_viewer_file_get_zoom_out(VirtViewerFile* self);
19ccae
+void virt_viewer_file_set_zoom_out(VirtViewerFile* self, const gchar* value);
19ccae
+gchar* virt_viewer_file_get_zoom_reset(VirtViewerFile* self);
19ccae
+void virt_viewer_file_set_zoom_reset(VirtViewerFile* self, const gchar* value);
19ccae
+
19ccae
 gint virt_viewer_file_get_enable_smartcard(VirtViewerFile* self);
19ccae
 void virt_viewer_file_set_enable_smartcard(VirtViewerFile* self, gint value);
19ccae
 gint virt_viewer_file_get_enable_usbredir(VirtViewerFile* self);
19ccae
-- 
19ccae
2.29.2
19ccae