summaryrefslogtreecommitdiff
path: root/server/display-channel.cpp
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2019-05-19 22:00:39 +0100
committerFrediano Ziglio <freddy77@gmail.com>2020-05-01 06:58:09 +0100
commit176970f3f18e26ef52f16155bc5fa6edbc60705a (patch)
tree713ca073daafa55d67b6cdbf767b2de31d242112 /server/display-channel.cpp
parent38cd152952968e37d0cc96e95e3e5e47a2f66c2f (diff)
red-channel-client: Remove GObject type
Make all RedChannelClient hierarchy a C++ class. This allows to use virtual methods. Added a normal contructor instead or properties and g_object_new. As we remove GObject conversion macros I added a macro XXX_CAST to create a function to replace the old macro. They will be removed when more type safety is introduced. There's a new SPICE_CXX_GLIB_ALLOCATOR macro in red-common.h. This macro, added to a class define the class allocator allowing to use, in this case, GLib for allocation. This to avoid C++ library dependency and to initialize all structure to 0 (not all fields are manually initialized, will be improved with more encapsulation). Currently the methods are mainly public, access will be modified when more encapsulation (all functions in method) are done. Some classes are now defined in the header, C++ uses access to limit accessibility but for efficiency and type safety/inline and other features require types to be defined in the headers. Some fields were moved from XxxPrivate structure to class, C++ has accessibility. Many destructors are defined as protected to forbid the use of stack, this as these objects uses internal reference counting to have normal pointers. Maybe in the future pointers like std::shared_ptr could be used instead. Reference counting is now implemented very easily using atomic operations. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Diffstat (limited to 'server/display-channel.cpp')
-rw-r--r--server/display-channel.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/server/display-channel.cpp b/server/display-channel.cpp
index 339a1a39..91d5829c 100644
--- a/server/display-channel.cpp
+++ b/server/display-channel.cpp
@@ -21,6 +21,8 @@
#include "display-channel-private.h"
#include "red-qxl.h"
+XXX_CAST(RedChannelClient, DisplayChannelClient, DISPLAY_CHANNEL_CLIENT);
+
G_DEFINE_TYPE(DisplayChannel, display_channel, TYPE_COMMON_GRAPHICS_CHANNEL)
static void display_channel_connect(RedChannel *channel, RedClient *client,