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