mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-09 22:36:29 +00:00
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>
70 lines
2.4 KiB
C++
70 lines
2.4 KiB
C++
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
/*
|
|
Copyright (C) 2009-2016 Red Hat, Inc.
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef CURSOR_CHANNEL_CLIENT_H_
|
|
#define CURSOR_CHANNEL_CLIENT_H_
|
|
|
|
#include "cache-item.h"
|
|
#include "red-common.h"
|
|
#include "red-channel-client.h"
|
|
#include "red-stream.h"
|
|
#include "cursor-channel.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
struct CursorChannelClientPrivate;
|
|
|
|
class CursorChannelClient final: public CommonGraphicsChannelClient
|
|
{
|
|
protected:
|
|
~CursorChannelClient();
|
|
public:
|
|
CursorChannelClient(RedChannel *channel,
|
|
RedClient *client,
|
|
RedStream *stream,
|
|
RedChannelCapabilities *caps);
|
|
virtual void on_disconnect() override;
|
|
CursorChannelClientPrivate *priv = nullptr;
|
|
};
|
|
|
|
CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
|
|
RedClient *client,
|
|
RedStream *stream,
|
|
int mig_target,
|
|
RedChannelCapabilities *caps);
|
|
|
|
void cursor_channel_client_reset_cursor_cache(CursorChannelClient *ccc);
|
|
RedCacheItem* cursor_channel_client_cache_find(CursorChannelClient *ccc, uint64_t id);
|
|
int cursor_channel_client_cache_add(CursorChannelClient *ccc, uint64_t id, size_t size);
|
|
|
|
enum {
|
|
RED_PIPE_ITEM_TYPE_CURSOR = RED_PIPE_ITEM_TYPE_COMMON_LAST,
|
|
RED_PIPE_ITEM_TYPE_CURSOR_INIT,
|
|
RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE,
|
|
};
|
|
|
|
/**
|
|
* Migrate a client channel from a CursorChannel.
|
|
* This is the equivalent of RedChannel client migrate callback.
|
|
*/
|
|
void cursor_channel_client_migrate(RedChannelClient *client);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* CURSOR_CHANNEL_CLIENT_H_ */
|