Introduce CommonGraphicsChannelClient

This prepare for the next patch.
The network recieve buffer should be per-client rather than per-channel.
The following patch will make this change, but this common base class
will allow the cursor client and the display client to share a common
implementation.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Frediano Ziglio 2017-02-27 15:52:41 +00:00
parent 62f961624a
commit 68c3e1f51d
6 changed files with 53 additions and 12 deletions

View File

@ -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)
{
}

View File

@ -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 */

View File

@ -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))

View File

@ -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;
};

View File

@ -27,7 +27,7 @@
#include "spice-server-enums.h"
#include "glib-compat.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

View File

@ -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;