[Spice-devel] [PATCH spice-server 1b/3] Introduce CommonGraphicsChannelClient

Frediano Ziglio fziglio at redhat.com
Tue Feb 28 09:43:34 UTC 2017


This prepare for the next patch.
As network buffer should be specific to the specific
RedChannelClient we should have one.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/common-graphics-channel.c | 12 ++++++++++++
 server/common-graphics-channel.h | 32 ++++++++++++++++++++++++++++++++
 server/cursor-channel-client.c   |  2 +-
 server/cursor-channel-client.h   |  5 ++---
 server/dcc.c                     |  2 +-
 server/dcc.h                     | 12 +++++-------
 6 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c
index bad6e8c..6faf1d7 100644
--- a/server/common-graphics-channel.c
+++ b/server/common-graphics-channel.c
@@ -31,6 +31,8 @@
 
 G_DEFINE_ABSTRACT_TYPE(CommonGraphicsChannel, common_graphics_channel, RED_TYPE_CHANNEL)
 
+G_DEFINE_TYPE(CommonGraphicsChannelClient, common_graphics_channel_client, RED_TYPE_CHANNEL_CLIENT)
+
 #define GRAPHICS_CHANNEL_PRIVATE(o) \
     (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelPrivate))
 
@@ -188,3 +190,13 @@ QXLInstance* common_graphics_channel_get_qxl(CommonGraphicsChannel *self)
 {
     return self->priv->qxl;
 }
+
+static void
+common_graphics_channel_client_init(CommonGraphicsChannelClient *self)
+{
+}
+
+static void
+common_graphics_channel_client_class_init(CommonGraphicsChannelClientClass *klass)
+{
+}
diff --git a/server/common-graphics-channel.h b/server/common-graphics-channel.h
index 4d88148..bdcb2c8 100644
--- a/server/common-graphics-channel.h
+++ b/server/common-graphics-channel.h
@@ -70,6 +70,38 @@ enum {
     RED_PIPE_ITEM_TYPE_COMMON_LAST
 };
 
+#define TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT common_graphics_channel_client_get_type()
+
+#define COMMON_GRAPHICS_CHANNEL_CLIENT(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \
+    CommonGraphicsChannelClient))
+#define COMMON_GRAPHICS_CHANNEL_CLIENT_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \
+    CommonGraphicsChannelClientClass))
+#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT))
+#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT))
+#define COMMON_GRAPHICS_CHANNEL_CLIENT_GET_CLASS(obj) \
+    (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \
+    CommonGraphicsChannelClientClass))
+
+typedef struct CommonGraphicsChannelClient CommonGraphicsChannelClient;
+typedef struct CommonGraphicsChannelClientClass CommonGraphicsChannelClientClass;
+typedef struct CommonGraphicsChannelClientPrivate CommonGraphicsChannelClientPrivate;
+
+struct CommonGraphicsChannelClient {
+    RedChannelClient parent;
+
+    CommonGraphicsChannelClientPrivate *priv;
+};
+
+struct CommonGraphicsChannelClientClass {
+    RedChannelClientClass parent_class;
+};
+
+GType common_graphics_channel_client_get_type(void) G_GNUC_CONST;
+
 G_END_DECLS
 
 #endif /* _COMMON_GRAPHICS_CHANNEL_H */
diff --git a/server/cursor-channel-client.c b/server/cursor-channel-client.c
index 1344719..70f99fe 100644
--- a/server/cursor-channel-client.c
+++ b/server/cursor-channel-client.c
@@ -35,7 +35,7 @@
 #define CURSOR_CACHE_HASH_KEY(id) ((id) & CURSOR_CACHE_HASH_MASK)
 #define CURSOR_CLIENT_TIMEOUT 30000000000ULL //nano
 
-G_DEFINE_TYPE(CursorChannelClient, cursor_channel_client, RED_TYPE_CHANNEL_CLIENT)
+G_DEFINE_TYPE(CursorChannelClient, cursor_channel_client, TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT)
 
 #define CURSOR_CHANNEL_CLIENT_PRIVATE(o) \
     (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_CURSOR_CHANNEL_CLIENT, CursorChannelClientPrivate))
diff --git a/server/cursor-channel-client.h b/server/cursor-channel-client.h
index 211ea94..1a81c52 100644
--- a/server/cursor-channel-client.h
+++ b/server/cursor-channel-client.h
@@ -45,9 +45,8 @@ typedef struct CursorChannelClient CursorChannelClient;
 typedef struct CursorChannelClientClass CursorChannelClientClass;
 typedef struct CursorChannelClientPrivate CursorChannelClientPrivate;
 
-struct CursorChannelClient
-{
-    RedChannelClient parent;
+struct CursorChannelClient {
+    CommonGraphicsChannelClient parent;
 
     CursorChannelClientPrivate *priv;
 };
diff --git a/server/dcc.c b/server/dcc.c
index 3cc9573..6cfd81b 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -26,7 +26,7 @@
 #include "main-channel-client.h"
 #include "spice-server-enums.h"
 
-G_DEFINE_TYPE(DisplayChannelClient, display_channel_client, RED_TYPE_CHANNEL_CLIENT)
+G_DEFINE_TYPE(DisplayChannelClient, display_channel_client, TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT)
 
 #define DISPLAY_CLIENT_SHORT_TIMEOUT 15000000000ULL //nano
 #define DISPLAY_FREE_LIST_DEFAULT_SIZE 128
diff --git a/server/dcc.h b/server/dcc.h
index 19416e3..762ce08 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -24,7 +24,7 @@
 #include "image-cache.h"
 #include "pixmap-cache.h"
 #include "display-limits.h"
-#include "red-channel-client.h"
+#include "common-graphics-channel.h"
 
 G_BEGIN_DECLS
 
@@ -45,18 +45,16 @@ typedef struct DisplayChannelClient DisplayChannelClient;
 typedef struct DisplayChannelClientClass DisplayChannelClientClass;
 typedef struct DisplayChannelClientPrivate DisplayChannelClientPrivate;
 
-struct DisplayChannelClient
-{
-    RedChannelClient parent;
+struct DisplayChannelClient {
+    CommonGraphicsChannelClient parent;
 
     int is_low_bandwidth;
 
     DisplayChannelClientPrivate *priv;
 };
 
-struct DisplayChannelClientClass
-{
-    RedChannelClientClass parent_class;
+struct DisplayChannelClientClass {
+    CommonGraphicsChannelClientClass parent_class;
 };
 
 GType display_channel_client_get_type(void) G_GNUC_CONST;
-- 
2.9.3



More information about the Spice-devel mailing list