[Spice-devel] [PATCH spice-server] reds: use SpiceMouseMode for RedsState::mouse_mode

Frediano Ziglio fziglio at redhat.com
Wed Aug 23 10:19:17 UTC 2017


Make easier to understant the value to use in the code.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/main-channel-client.c | 6 +++---
 server/main-channel-client.h | 4 ++--
 server/main-channel.c        | 2 +-
 server/main-channel.h        | 3 ++-
 server/reds-private.h        | 2 +-
 server/reds.c                | 6 +++---
 server/reds.h                | 2 +-
 7 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index ae8d2d50..82b578c8 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -110,7 +110,7 @@ typedef struct RedNotifyPipeItem {
 
 typedef struct RedMouseModePipeItem {
     RedPipeItem base;
-    int current_mode;
+    SpiceMouseMode current_mode;
     int is_client_mouse_allowed;
 } RedMouseModePipeItem;
 
@@ -331,7 +331,7 @@ void main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data,
 
 static RedPipeItem *main_init_item_new(int connection_id,
                                        int display_channels_hint,
-                                       int current_mouse_mode,
+                                       SpiceMouseMode current_mouse_mode,
                                        int is_client_mouse_allowed,
                                        int multi_media_time,
                                        int ram_hint)
@@ -350,7 +350,7 @@ static RedPipeItem *main_init_item_new(int connection_id,
 
 void main_channel_client_push_init(MainChannelClient *mcc,
                                    int display_channels_hint,
-                                   int current_mouse_mode,
+                                   SpiceMouseMode current_mouse_mode,
                                    int is_client_mouse_allowed,
                                    int multi_media_time,
                                    int ram_hint)
diff --git a/server/main-channel-client.h b/server/main-channel-client.h
index cf54f51b..a2e38c2f 100644
--- a/server/main-channel-client.h
+++ b/server/main-channel-client.h
@@ -69,7 +69,7 @@ void main_channel_client_start_net_test(MainChannelClient *mcc, int test_rate);
 // and calling from main.
 void main_channel_client_push_init(MainChannelClient *mcc,
                                    int display_channels_hint,
-                                   int current_mouse_mode,
+                                   SpiceMouseMode current_mouse_mode,
                                    int is_client_mouse_allowed,
                                    int multi_media_time,
                                    int ram_hint);
@@ -125,7 +125,7 @@ enum {
 };
 
 typedef struct MainMouseModeItemInfo {
-    int current_mode;
+    SpiceMouseMode current_mode;
     int is_client_mouse_allowed;
 } MainMouseModeItemInfo;
 
diff --git a/server/main-channel.c b/server/main-channel.c
index 5aaba0ab..4834f79b 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -84,7 +84,7 @@ static void main_channel_push_channels(MainChannelClient *mcc)
     red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST);
 }
 
-void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode,
+void main_channel_push_mouse_mode(MainChannel *main_chan, SpiceMouseMode current_mode,
                                   int is_client_mouse_allowed)
 {
     MainMouseModeItemInfo info = {
diff --git a/server/main-channel.h b/server/main-channel.h
index 8f886ddf..833957dd 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -61,7 +61,8 @@ RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t l
 MainChannelClient *main_channel_link(MainChannel *, RedClient *client,
      RedsStream *stream, uint32_t link_id, int migration,
      RedChannelCapabilities *caps);
-void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode, int is_client_mouse_allowed);
+void main_channel_push_mouse_mode(MainChannel *main_chan, SpiceMouseMode current_mode,
+                                  int is_client_mouse_allowed);
 void main_channel_push_agent_connected(MainChannel *main_chan);
 void main_channel_push_agent_disconnected(MainChannel *main_chan);
 void main_channel_push_multi_media_time(MainChannel *main_chan, int time);
diff --git a/server/reds-private.h b/server/reds-private.h
index c4ab3d1c..259496c6 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -101,7 +101,7 @@ struct RedsState {
     GList *mig_target_clients;
 
     GList *channels;
-    int mouse_mode;
+    SpiceMouseMode mouse_mode;
     int is_client_mouse_allowed;
     int dispatcher_allows_client_mouse;
     MonitorMode monitor_mode;
diff --git a/server/reds.c b/server/reds.c
index 33f038c7..03fa25d1 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -304,7 +304,7 @@ static void reds_on_sv_change(RedsState *reds);
 static void reds_on_vc_change(RedsState *reds);
 static void reds_on_vm_stop(RedsState *reds);
 static void reds_on_vm_start(RedsState *reds);
-static void reds_set_mouse_mode(RedsState *reds, uint32_t mode);
+static void reds_set_mouse_mode(RedsState *reds, SpiceMouseMode mode);
 static uint32_t reds_qxl_ram_size(RedsState *reds);
 static int calc_compression_level(RedsState *reds);
 
@@ -596,12 +596,12 @@ bool reds_config_get_playback_compression(RedsState *reds)
     return reds->config->playback_compression;
 }
 
-int reds_get_mouse_mode(RedsState *reds)
+SpiceMouseMode reds_get_mouse_mode(RedsState *reds)
 {
     return reds->mouse_mode;
 }
 
-static void reds_set_mouse_mode(RedsState *reds, uint32_t mode)
+static void reds_set_mouse_mode(RedsState *reds, SpiceMouseMode mode)
 {
     QXLInstance *qxl;
 
diff --git a/server/reds.h b/server/reds.h
index bbd33b09..ee5a46c0 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -48,7 +48,7 @@ uint32_t reds_get_mm_time(void);
 void reds_register_channel(RedsState *reds, RedChannel *channel);
 void reds_unregister_channel(RedsState *reds, RedChannel *channel);
 RedChannel *reds_find_channel(RedsState *reds, uint32_t type, uint32_t id);
-int reds_get_mouse_mode(RedsState *reds); // used by inputs_channel
+SpiceMouseMode reds_get_mouse_mode(RedsState *reds); // used by inputs_channel
 gboolean reds_config_get_agent_mouse(const RedsState *reds); // used by inputs_channel
 int reds_has_vdagent(RedsState *reds); // used by inputs channel
 bool reds_config_get_playback_compression(RedsState *reds); // used by playback channel
-- 
2.13.5



More information about the Spice-devel mailing list