[virt-tools-list] [PATCH virt-viewer 3/4] SessionSpice: Keep track of auto conf state
Jonathon Jongsma
jjongsma at redhat.com
Thu Apr 16 20:38:37 UTC 2015
Instead of simply a boolean that tracks whether we've done auto-conf,
make it a state variable, currently with three states: NONE, SENT, and
RECEIVED. This will allow us to verify whether the auto conf state has
been set successfully.
---
src/virt-viewer-session-spice.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 8e93b4a..4620bba 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -47,6 +47,12 @@
G_DEFINE_TYPE (VirtViewerSessionSpice, virt_viewer_session_spice, VIRT_VIEWER_TYPE_SESSION)
+typedef enum {
+ AUTO_CONF_STATE_NONE,
+ AUTO_CONF_STATE_SENT,
+ AUTO_CONF_STATE_COMPLETE
+} AutoConfState;
+
struct _VirtViewerSessionSpicePrivate {
GtkWindow *main_window;
SpiceSession *session;
@@ -57,7 +63,7 @@ struct _VirtViewerSessionSpicePrivate {
int usbredir_channel_count;
gboolean has_sw_smartcard_reader;
guint pass_try;
- gboolean did_auto_conf;
+ AutoConfState auto_conf_state;
GList *display_channels;
GArray *fullscreen_config;
};
@@ -839,7 +845,7 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
/* only do auto-conf once at startup. Avoid repeating auto-conf later due to
* agent disconnection/re-connection, etc */
- if (self->priv->did_auto_conf) {
+ if (self->priv->auto_conf_state != AUTO_CONF_STATE_NONE) {
g_debug("Already did auto-conf, skipping");
return FALSE;
}
@@ -893,7 +899,7 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
}
spice_main_send_monitor_config(cmain);
- self->priv->did_auto_conf = TRUE;
+ self->priv->auto_conf_state = AUTO_CONF_STATE_SENT;
self->priv->fullscreen_config = config;
return TRUE;
--
2.1.0
More information about the virt-tools-list
mailing list