[PATCH 09/18] Move agent_copypaste to RedsState struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

Removing more global variables
---
 server/reds-private.h |  1 +
 server/reds.c         | 16 ++++++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/server/reds-private.h b/server/reds-private.h
index 9bfade8..52f88f8 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -222,6 +222,7 @@ struct RedsState {
     spice_wan_compression_t zlib_glz_state;
 
     gboolean agent_mouse;
+    gboolean agent_copypaste;
 };
 
 #endif
diff --git a/server/reds.c b/server/reds.c
index c527c0e..b7c04e4 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -146,7 +146,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter = {
 
 static pthread_mutex_t *lock_cs;
 static long *lock_count;
-int agent_copypaste = TRUE;
 int agent_file_xfer = TRUE;
 static bool exit_on_disconnect = FALSE;
 
@@ -414,7 +413,7 @@ static void reds_reset_vdp(RedsState *reds)
         state->current_read_buf = NULL;
     }
     /* Reset read filter to start with clean state when the agent reconnects */
-    agent_msg_filter_init(&state->read_filter, agent_copypaste,
+    agent_msg_filter_init(&state->read_filter, reds->agent_copypaste,
                           agent_file_xfer, TRUE);
     /* Throw away pending chunks from the current (if any) and future
      * messages written by the client.
@@ -528,7 +527,7 @@ void reds_client_disconnect(RedsState *reds, RedClient *client)
         }
 
         /* Reset write filter to start with clean state on client reconnect */
-        agent_msg_filter_init(&reds->agent_state.write_filter, agent_copypaste,
+        agent_msg_filter_init(&reds->agent_state.write_filter, reds->agent_copypaste,
                               agent_file_xfer, TRUE);
 
         /* Throw away pending chunks from the current (if any) and future
@@ -3293,9 +3292,9 @@ static void reds_init_vd_agent_resources(RedsState *reds)
     int i;
 
     ring_init(&state->read_bufs);
-    agent_msg_filter_init(&state->write_filter, agent_copypaste,
+    agent_msg_filter_init(&state->write_filter, reds->agent_copypaste,
                           agent_file_xfer, TRUE);
-    agent_msg_filter_init(&state->read_filter, agent_copypaste,
+    agent_msg_filter_init(&state->read_filter, reds->agent_copypaste,
                           agent_file_xfer, TRUE);
 
     state->read_state = VDI_PORT_READ_STATE_READ_HEADER;
@@ -3428,6 +3427,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
     reds->jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
     reds->zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
     reds->agent_mouse = TRUE;
+    reds->agent_copypaste = TRUE;
     return reds;
 }
 
@@ -3810,9 +3810,9 @@ SPICE_GNUC_VISIBLE int spice_server_set_agent_mouse(SpiceServer *s, int enable)
 SPICE_GNUC_VISIBLE int spice_server_set_agent_copypaste(SpiceServer *s, int enable)
 {
     spice_assert(reds == s);
-    agent_copypaste = enable;
-    reds->agent_state.write_filter.copy_paste_enabled = agent_copypaste;
-    reds->agent_state.read_filter.copy_paste_enabled = agent_copypaste;
+    s->agent_copypaste = enable;
+    reds->agent_state.write_filter.copy_paste_enabled = s->agent_copypaste;
+    reds->agent_state.read_filter.copy_paste_enabled = s->agent_copypaste;
     return 0;
 }
 
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]