[virt-tools-list] [PATCH virt-viewer v2 6/7] Apply zoom setting to fullscreen auto-conf

Jonathon Jongsma jjongsma at redhat.com
Tue Apr 21 20:34:34 UTC 2015


The zoom value specified on the commandline (--zoom) was being ignored
for fullscreen auto-conf. This change sets the guest resolution to match
the client resolution scaled by the zoom factor.
---
 src/virt-viewer-app.c           | 5 +++++
 src/virt-viewer-app.h           | 1 +
 src/virt-viewer-session-spice.c | 7 +++++++
 3 files changed, 13 insertions(+)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 563117a..f5c054d 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -2553,6 +2553,11 @@ virt_viewer_app_get_option_group(void)
     return group;
 }
 
+gint virt_viewer_app_get_zoom_level(VirtViewerApp *self)
+{
+    return virt_viewer_window_get_zoom_level(virt_viewer_app_get_main_window(self));
+}
+
 /*
  * Local variables:
  *  c-indent-level: 4
diff --git a/src/virt-viewer-app.h b/src/virt-viewer-app.h
index 6af9c01..49ffa82 100644
--- a/src/virt-viewer-app.h
+++ b/src/virt-viewer-app.h
@@ -72,6 +72,7 @@ gboolean virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type,
 gboolean virt_viewer_app_activate(VirtViewerApp *self, GError **error);
 gboolean virt_viewer_app_initial_connect(VirtViewerApp *self, GError **error);
 void virt_viewer_app_set_zoom_level(VirtViewerApp *self, gint zoom_level);
+gint virt_viewer_app_get_zoom_level(VirtViewerApp *self);
 gboolean virt_viewer_app_get_direct(VirtViewerApp *self);
 void virt_viewer_app_set_direct(VirtViewerApp *self, gboolean direct);
 void virt_viewer_app_set_hotkeys(VirtViewerApp *self, const gchar *hotkeys);
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 9a9a337..1576f00 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -990,11 +990,18 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
     g_debug("Performing full screen auto-conf, %u host monitors", ndisplays);
     config = g_array_sized_new(FALSE, TRUE, sizeof(GdkRectangle), ndisplays);
 
+    double zoom = (double)virt_viewer_app_get_zoom_level(app) / NORMAL_ZOOM_LEVEL;
     for (i = 0, l = initial_displays; l != NULL; l = l->next, i++) {
         GdkRectangle rect = { 0 };
         gint j = virt_viewer_app_get_initial_monitor_for_display(app, GPOINTER_TO_INT(l->data));
         if (j != -1) {
             gdk_screen_get_monitor_geometry(screen, j, &rect);
+
+            rect.x = rect.x / zoom;
+            rect.y = rect.y / zoom;
+            rect.width = rect.width / zoom;
+            rect.height = rect.height / zoom;
+
             g_array_append_val(config, rect);
         }
     }
-- 
2.1.0




More information about the virt-tools-list mailing list