[Spice-commits] 2 commits - server/inputs-channel.c server/red-dispatcher.c server/reds.c server/reds.h server/reds-private.h server/red-worker.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu Feb 4 09:07:53 UTC 2016


 server/inputs-channel.c |    8 ++++----
 server/red-dispatcher.c |    7 ++++---
 server/red-worker.c     |    2 +-
 server/reds-private.h   |    2 ++
 server/reds.c           |   19 ++++++++++++-------
 server/reds.h           |    4 ++--
 6 files changed, 25 insertions(+), 17 deletions(-)

New commits:
commit 4b228d5c1f305247fe91625d8c33e992ce122eec
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Jan 27 14:20:08 2015 -0600

    Move agent_mouse to RedsState struct
    
    Required adding a RedsState arg to reds_get_agent_mouse()
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 8f5ab37..319d26c 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -355,8 +355,8 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
         if (reds_get_mouse_mode(reds) != SPICE_MOUSE_MODE_CLIENT) {
             break;
         }
-        spice_assert((reds_get_agent_mouse() && reds_has_vdagent(reds)) || tablet);
-        if (!reds_get_agent_mouse() || !reds_has_vdagent(reds)) {
+        spice_assert((reds_get_agent_mouse(reds) && reds_has_vdagent(reds)) || tablet);
+        if (!reds_get_agent_mouse(reds) || !reds_has_vdagent(reds)) {
             SpiceTabletInterface *sif;
             sif = SPICE_CONTAINEROF(tablet->base.sif, SpiceTabletInterface, base);
             sif->position(tablet, pos->x, pos->y, RED_MOUSE_STATE_TO_LOCAL(pos->buttons_state));
@@ -379,7 +379,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
             dz = 1;
         }
         if (reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_CLIENT) {
-            if (reds_get_agent_mouse() && reds_has_vdagent(reds)) {
+            if (reds_get_agent_mouse(reds) && reds_has_vdagent(reds)) {
                 inputs_channel->mouse_state.buttons =
                     RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_press->buttons_state) |
                     (dz == -1 ? VD_AGENT_UBUTTON_MASK : 0) |
@@ -401,7 +401,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
     case SPICE_MSGC_INPUTS_MOUSE_RELEASE: {
         SpiceMsgcMouseRelease *mouse_release = message;
         if (reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_CLIENT) {
-            if (reds_get_agent_mouse() && reds_has_vdagent(reds)) {
+            if (reds_get_agent_mouse(reds) && reds_has_vdagent(reds)) {
                 inputs_channel->mouse_state.buttons =
                     RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_release->buttons_state);
                 reds_handle_agent_mouse_event(reds, &inputs_channel->mouse_state);
diff --git a/server/reds-private.h b/server/reds-private.h
index 8718267..a36914e 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -220,6 +220,7 @@ struct RedsState {
     spice_wan_compression_t jpeg_state;
     spice_wan_compression_t zlib_glz_state;
 
+    gboolean agent_mouse;
     gboolean agent_copypaste;
     gboolean agent_file_xfer;
     gboolean exit_on_disconnect;
diff --git a/server/reds.c b/server/reds.c
index d6cd60a..174bf5b 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_mouse = TRUE;
 
 RedsState *reds = NULL;
 
@@ -577,9 +576,9 @@ static void reds_set_mouse_mode(RedsState *reds, uint32_t mode)
     main_channel_push_mouse_mode(reds->main_channel, reds->mouse_mode, reds->is_client_mouse_allowed);
 }
 
-int reds_get_agent_mouse(void)
+gboolean reds_get_agent_mouse(const RedsState *reds)
 {
-    return agent_mouse;
+    return reds->agent_mouse;
 }
 
 static void reds_update_mouse_mode(RedsState *reds)
@@ -587,7 +586,7 @@ static void reds_update_mouse_mode(RedsState *reds)
     int allowed = 0;
     int qxl_count = red_dispatcher_qxl_count();
 
-    if ((agent_mouse && reds->vdagent) ||
+    if ((reds->agent_mouse && reds->vdagent) ||
         (inputs_channel_has_tablet(reds->inputs_channel) && qxl_count == 1)) {
         allowed = reds->dispatcher_allows_client_mouse;
     }
@@ -3426,6 +3425,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
     reds->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
     reds->jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
     reds->zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
+    reds->agent_mouse = TRUE;
     reds->agent_copypaste = TRUE;
     reds->agent_file_xfer = TRUE;
     reds->exit_on_disconnect = FALSE;
@@ -3807,7 +3807,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_playback_compression(SpiceServer *s, int
 SPICE_GNUC_VISIBLE int spice_server_set_agent_mouse(SpiceServer *s, int enable)
 {
     spice_assert(reds == s);
-    agent_mouse = enable;
+    reds->agent_mouse = enable;
     reds_update_mouse_mode(reds);
     return 0;
 }
diff --git a/server/reds.h b/server/reds.h
index 8230716..a499b10 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -59,7 +59,7 @@ void reds_set_client_mouse_allowed(RedsState *reds,
 void reds_register_channel(RedsState *reds, RedChannel *channel);
 void reds_unregister_channel(RedsState *reds, RedChannel *channel);
 int reds_get_mouse_mode(RedsState *reds); // used by inputs_channel
-int reds_get_agent_mouse(void); // used by inputs_channel
+gboolean reds_get_agent_mouse(const RedsState *reds); // used by inputs_channel
 int reds_has_vdagent(RedsState *reds); // used by inputs channel
 void reds_handle_agent_mouse_event(RedsState *reds, const VDAgentMouseState *mouse_state); // used by inputs_channel
 
commit e7e42f4126f52ea2c850a51bacd2f258cfd925c5
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Wed Feb 3 15:10:56 2016 -0600

    Move streaming_video to RedsState struct
    
    Also requires adding reds_get_streaming_video() accessor so that other
    files can check this value.
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red-dispatcher.c b/server/red-dispatcher.c
index fa2a42c..374d5a9 100644
--- a/server/red-dispatcher.c
+++ b/server/red-dispatcher.c
@@ -704,8 +704,9 @@ static void qxl_worker_loadvm_commands(QXLWorker *qxl_worker,
 
 static inline int calc_compression_level(void)
 {
-    spice_assert(streaming_video != SPICE_STREAM_VIDEO_INVALID);
-    if ((streaming_video != SPICE_STREAM_VIDEO_OFF) ||
+    spice_assert(reds_get_streaming_video(reds) != SPICE_STREAM_VIDEO_INVALID);
+
+    if ((reds_get_streaming_video(reds) != SPICE_STREAM_VIDEO_OFF) ||
         (spice_server_get_image_compression(reds) != SPICE_IMAGE_COMPRESSION_QUIC)) {
         return 0;
     } else {
@@ -736,7 +737,7 @@ void red_dispatcher_on_sv_change(void)
     RedDispatcher *now = dispatchers;
     while (now) {
         now->qxl->st->qif->set_compression_level(now->qxl, compression_level);
-        payload.streaming_video = streaming_video;
+        payload.streaming_video = reds_get_streaming_video(reds);
         dispatcher_send_message(&now->dispatcher,
                                 RED_WORKER_MESSAGE_SET_STREAMING_VIDEO,
                                 &payload);
diff --git a/server/red-worker.c b/server/red-worker.c
index 6a48434..df24a5b 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -1542,7 +1542,7 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
 
     worker->cursor_channel = cursor_channel_new(worker);
     // TODO: handle seemless migration. Temp, setting migrate to FALSE
-    worker->display_channel = display_channel_new(worker, FALSE, streaming_video,
+    worker->display_channel = display_channel_new(worker, FALSE, reds_get_streaming_video(reds),
                                                   init_info.n_surfaces);
 
     return worker;
diff --git a/server/reds-private.h b/server/reds-private.h
index 6a18c1b..8718267 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -215,6 +215,7 @@ struct RedsState {
     uint8_t spice_uuid[16];
 
     gboolean ticketing_enabled;
+    uint32_t streaming_video;
     SpiceImageCompression image_compression;
     spice_wan_compression_t jpeg_state;
     spice_wan_compression_t zlib_glz_state;
diff --git a/server/reds.c b/server/reds.c
index e8d5392..d6cd60a 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;
-uint32_t streaming_video = SPICE_STREAM_VIDEO_FILTER;
 int agent_mouse = TRUE;
 
 RedsState *reds = NULL;
@@ -3423,6 +3422,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
     reds->spice_uuid_is_set = FALSE;
     memset(reds->spice_uuid, 0, sizeof(reds->spice_uuid));
     reds->ticketing_enabled = TRUE; /* ticketing enabled by default */
+    reds->streaming_video = SPICE_STREAM_VIDEO_FILTER;
     reds->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
     reds->jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
     reds->zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
@@ -3787,11 +3787,16 @@ SPICE_GNUC_VISIBLE int spice_server_set_streaming_video(SpiceServer *s, int valu
         value != SPICE_STREAM_VIDEO_ALL &&
         value != SPICE_STREAM_VIDEO_FILTER)
         return -1;
-    streaming_video = value;
+    s->streaming_video = value;
     red_dispatcher_on_sv_change();
     return 0;
 }
 
+uint32_t reds_get_streaming_video(const RedsState *reds)
+{
+    return reds->streaming_video;
+}
+
 SPICE_GNUC_VISIBLE int spice_server_set_playback_compression(SpiceServer *s, int enable)
 {
     spice_assert(reds == s);
diff --git a/server/reds.h b/server/reds.h
index 35a7fec..8230716 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -74,7 +74,6 @@ extern uint32_t renderers[RED_RENDERER_LAST];
 extern uint32_t num_renderers;
 
 extern struct SpiceCoreInterfaceInternal *core;
-extern uint32_t streaming_video;
 
 // Temporary measures to make splitting reds.c to inputs-channel.c easier
 
@@ -111,6 +110,7 @@ void reds_on_main_channel_migrate(RedsState *reds, MainChannelClient *mcc);
 void reds_on_char_device_state_destroy(RedsState *reds, SpiceCharDeviceState *dev);
 
 void reds_set_client_mm_time_latency(RedsState *reds, RedClient *client, uint32_t latency);
+uint32_t reds_get_streaming_video(const RedsState *reds);
 spice_wan_compression_t reds_get_jpeg_state(const RedsState *reds);
 spice_wan_compression_t reds_get_zlib_glz_state(const RedsState *reds);
 


More information about the Spice-commits mailing list