[virt-tools-list] [PATCH] VirtViewerDisplaySpice: rename AUTO_RESIZE_FULLSCREEN

Jonathon Jongsma jjongsma at redhat.com
Thu Sep 19 17:10:24 UTC 2013


I find the AUTO_RESIZE_FULLSCREEN enum name to be slightly confusing. To me, it
implies that we should always auto-resize when the window is fullscreen. But
what it actually means is that we should only auto-resize *once* when the window
first becomes fullscreen.

Rename it to AUTO_RESIZE_ONCE to make that behavior more clear and to match the
other values (ALWAYS, NEVER) a bit more closely.
---
 src/virt-viewer-display-spice.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 48f07e3..5a54463 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -35,17 +35,18 @@
 
 G_DEFINE_TYPE (VirtViewerDisplaySpice, virt_viewer_display_spice, VIRT_VIEWER_TYPE_DISPLAY)
 
+typedef enum {
+    AUTO_RESIZE_ALWAYS,
+    AUTO_RESIZE_ONCE,
+    AUTO_RESIZE_NEVER,
+} AutoResizeMode;
+
 struct _VirtViewerDisplaySpicePrivate {
     SpiceChannel *channel; /* weak reference */
     SpiceDisplay *display;
-    int auto_resize;
+    AutoResizeMode auto_resize;
 };
 
-enum {
-    AUTO_RESIZE_ALWAYS,
-    AUTO_RESIZE_FULLSCREEN,
-    AUTO_RESIZE_NEVER,
-};
 
 #define VIRT_VIEWER_DISPLAY_SPICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY_SPICE, VirtViewerDisplaySpicePrivate))
 
@@ -197,7 +198,7 @@ virt_viewer_display_spice_resize(VirtViewerDisplaySpice *self,
     if (virt_viewer_display_get_show_hint(VIRT_VIEWER_DISPLAY(self)) & VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED)
         return;
 
-    if (self->priv->auto_resize == AUTO_RESIZE_FULLSCREEN) {
+    if (self->priv->auto_resize == AUTO_RESIZE_ONCE) {
         GdkRectangle monitor;
         GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(self));
         int n = virt_viewer_display_get_monitor(VIRT_VIEWER_DISPLAY(self));
@@ -246,7 +247,7 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
     virt_viewer_display_spice_resize(self, allocation,
                                      self->priv->auto_resize != AUTO_RESIZE_NEVER);
 
-    if (self->priv->auto_resize == AUTO_RESIZE_FULLSCREEN)
+    if (self->priv->auto_resize == AUTO_RESIZE_ONCE)
         self->priv->auto_resize = AUTO_RESIZE_NEVER;
 }
 
@@ -291,7 +292,7 @@ fullscreen_changed(VirtViewerDisplaySpice *self,
         if (auto_conf)
             self->priv->auto_resize = AUTO_RESIZE_NEVER;
         else
-            self->priv->auto_resize = AUTO_RESIZE_FULLSCREEN;
+            self->priv->auto_resize = AUTO_RESIZE_ONCE;
     } else
         self->priv->auto_resize = AUTO_RESIZE_ALWAYS;
 }
-- 
1.8.3.1




More information about the virt-tools-list mailing list