[Spice-commits] server/cursor-channel.c server/cursor-channel.h server/red-worker.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu May 26 10:03:55 UTC 2016


 server/cursor-channel.c |   15 +++++++++++----
 server/cursor-channel.h |    7 ++-----
 server/red-worker.c     |    4 ++--
 3 files changed, 15 insertions(+), 11 deletions(-)

New commits:
commit 1d3cd7d6178e24ff758197d67001fd7714a29a97
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri May 13 09:55:29 2016 +0100

    Hide CursorChannelClient implementation details
    
    The existence of this class can be hidden to user of CursorChannel class
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index c9e9657..ea5441c 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -31,6 +31,8 @@
 #define CURSOR_CACHE_HASH_MASK (CURSOR_CACHE_HASH_SIZE - 1)
 #define CURSOR_CACHE_HASH_KEY(id) ((id) & CURSOR_CACHE_HASH_MASK)
 
+typedef struct CursorChannelClient CursorChannelClient;
+
 enum {
     RED_PIPE_ITEM_TYPE_CURSOR = RED_PIPE_ITEM_TYPE_COMMON_LAST,
     RED_PIPE_ITEM_TYPE_CURSOR_INIT,
@@ -362,9 +364,9 @@ CursorChannel* cursor_channel_new(RedWorker *worker)
     return cursor_channel;
 }
 
-void cursor_channel_client_migrate(CursorChannelClient* client)
+void cursor_channel_client_migrate(RedChannelClient *rcc)
 {
-    RedChannelClient *rcc;
+    CursorChannelClient* client = (CursorChannelClient*)rcc;
 
     spice_return_if_fail(client);
     rcc = RED_CHANNEL_CLIENT(client);
@@ -471,7 +473,7 @@ void cursor_channel_reset(CursorChannel *cursor)
     }
 }
 
-void cursor_channel_init(CursorChannel *cursor, CursorChannelClient *client)
+static void cursor_channel_init_client(CursorChannel *cursor, CursorChannelClient *client)
 {
     spice_return_if_fail(cursor);
 
@@ -488,6 +490,11 @@ void cursor_channel_init(CursorChannel *cursor, CursorChannelClient *client)
         red_channel_pipes_add_type(RED_CHANNEL(cursor), RED_PIPE_ITEM_TYPE_CURSOR_INIT);
 }
 
+void cursor_channel_init(CursorChannel *cursor)
+{
+    cursor_channel_init_client(cursor, NULL);
+}
+
 void cursor_channel_set_mouse_mode(CursorChannel *cursor, uint32_t mode)
 {
     spice_return_if_fail(cursor);
@@ -515,5 +522,5 @@ void cursor_channel_connect(CursorChannel *cursor, RedClient *client, RedsStream
     red_channel_client_ack_zero_messages_window(rcc);
     red_channel_client_push_set_ack(rcc);
 
-    cursor_channel_init(cursor, ccc);
+    cursor_channel_init_client(cursor, ccc);
 }
diff --git a/server/cursor-channel.h b/server/cursor-channel.h
index 6bba822..6c89bc3 100644
--- a/server/cursor-channel.h
+++ b/server/cursor-channel.h
@@ -24,14 +24,11 @@
 #include "red-parse-qxl.h"
 
 typedef struct CursorChannel CursorChannel;
-typedef struct CursorChannelClient CursorChannelClient;
-
-#define CURSOR_CHANNEL_CLIENT(Client) ((CursorChannelClient*)(Client))
 
 CursorChannel*       cursor_channel_new         (RedWorker *worker);
 void                 cursor_channel_disconnect  (CursorChannel *cursor_channel);
 void                 cursor_channel_reset       (CursorChannel *cursor);
-void                 cursor_channel_init        (CursorChannel *cursor, CursorChannelClient* client);
+void                 cursor_channel_init        (CursorChannel *cursor);
 void                 cursor_channel_process_cmd (CursorChannel *cursor, RedCursorCmd *cursor_cmd);
 void                 cursor_channel_set_mouse_mode(CursorChannel *cursor, uint32_t mode);
 void                 cursor_channel_connect     (CursorChannel *cursor, RedClient *client, 
@@ -40,6 +37,6 @@ void                 cursor_channel_connect     (CursorChannel *cursor, RedClien
                                                  uint32_t *common_caps, int num_common_caps,
                                                  uint32_t *caps, int num_caps);
 
-void                 cursor_channel_client_migrate(CursorChannelClient* client);
+void                 cursor_channel_client_migrate(RedChannelClient *client);
 
 #endif /* CURSOR_CHANNEL_H_ */
diff --git a/server/red-worker.c b/server/red-worker.c
index b7e40f5..3603025 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -687,7 +687,7 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
         red_channel_push(&worker->display_channel->common.base);
     }
 
-    cursor_channel_init(worker->cursor_channel, NULL);
+    cursor_channel_init(worker->cursor_channel);
 }
 
 static void handle_dev_create_primary_surface(void *opaque, void *payload)
@@ -1000,7 +1000,7 @@ static void handle_dev_cursor_migrate(void *opaque, void *payload)
     RedChannelClient *rcc = msg->rcc;
 
     spice_info("migrate cursor client");
-    cursor_channel_client_migrate(CURSOR_CHANNEL_CLIENT(rcc));
+    cursor_channel_client_migrate(rcc);
 }
 
 static void handle_dev_set_compression(void *opaque, void *payload)


More information about the Spice-commits mailing list