Commit Graph

36 Commits

Author SHA1 Message Date
Frediano Ziglio
1d4fb2fee7 red-parse-qxl: Use a base reference class for RedCursorCmd
Don't code manually reference counting for this structure

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-04 13:01:05 +01:00
Frediano Ziglio
bd6d043152 Remove some red_pipe_item_(un)ref usage
Replace with smart pointers instead.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-07-13 19:48:02 +01:00
Frediano Ziglio
4dbc6dae01 cursor-channel: Turn cursor_channel_reset into method
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:37:44 +01:00
Frediano Ziglio
e044c5bd50 cursor-channel: Turn cursor_channel_set_mouse_mode into method
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:37:42 +01:00
Frediano Ziglio
f30d35a8c7 cursor-channel: Turn cursor_channel_do_init into method
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:37:41 +01:00
Frediano Ziglio
0528fadff3 cursor-channel: Turn cursor_channel_process_cmd into method
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:37:38 +01:00
Frediano Ziglio
597461e443 Add and use red::make_shared
Allow to create an object already contained in a shared pointer
to avoid having not owned objects.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
104aa6e1af Remove GObject from RedChannel
The patch seems pretty huge but mainly are mechanical steps:
- remove GObject declarations
- do not inherit from GObject
- add SPICE_CXX_GLIB_ALLOCATOR to avoid using C++ allocators
- CLASS_init and CLASS_constructor code goes into C++ constructor
- CLASS_dispose and CLASS_finalize code goes into C++ destructor
- g_object_new is replaced by new operator
- class members goes into virtual methods
- class parameters became argument to constructor
- use push-visibility.h and pop-visibility.h to limit visibility
- temporary use XXX_CAST for old GObject casts, they will
  be replaced
- g_object_get is replaced by accessors

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
77af39d6b5 Update header style
Avoid typedef useless in C++.
Remove useless forward declarations.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Jonathon Jongsma
14403117b5 Make channel client callbacks virtual functions
Rather than having an API to register client callbacks for each channel
type, make them vfuncs.

Since the client callbacks are registered identically for each channel
of the same type, it doesn't make sense for to require these to be
registered separately for each object.  It's cleaner to have these be
per-class properties, so they've been converted to virtual functions.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-28 20:20:25 +00:00
Frediano Ziglio
571dc645c5 Move thread/dispatching handling to RedChannel
Currently channel threading/handling is spread between RedQxl,
RedWorker and RedChannel.
Move more to RedChannel simplify RedQxl and RedWorker.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-28 20:20:25 +00:00
Jonathon Jongsma
a5aa2a2261 Use standard "Red" namespace
The objects RedsStream and RedsSASL are currently using the namespace
"Reds" rather than the standard "Red" namespace used throughout the rest
of the project. Change these to be consistent. This also means changing
method names and some related enumeration types.

The files were also renamed to reflect the change:
  reds-stream.[ch] -> red-stream.[ch]

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-10-21 08:47:02 +01:00
Frediano Ziglio
8e7d5ac580 cursor-channel: Remove dependency from QXL
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-07 06:41:49 +01:00
Christophe Fergeau
becd0d30f6 cursor: Remove cursor_channel_disconnect()
cursor_channel_disconnect() calls
cursor_channel_client_reset_cursor_cache() on all CursorChannelClient
associated with the current CursorChannel before calling
red_channel_disconnect().

red_channel_disconnect() will iterate over all CursorChannelClient
calling red_channel_client_disconnect(), which will eventually call
CursorChannelClient::on_disconnect. This will in turn
cursor_channel_client_reset_cursor_cache(), so calling it in
cursor_channel_disconnect() before calling red_channel_disconnect() is
redundant.

cursor_channel_disconnect() can thus be replaced by a direct call to
red_channel_disconnect().

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-08-31 15:51:57 +02:00
Christophe Fergeau
bc5326b1ce Unify header guards
This changes the header guards in all .h files to follow this format:

/*
 * Licensing block
 */

/* ... */

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-30 18:17:20 +01:00
Frediano Ziglio
afc4171c98 red-channel: Use RedChannelCapabilities directly to pass capabilities
For each channel there are two set of capabilities, one
for the common ones and one for the specific ones.
A single set were almost always passed using 2 arguments,
a number of elements and an array but then before using
these were converted to a GArray.
Use a single structure (already available) to pass all
channel capabilites using a single argument.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-02 15:34:58 +00:00
Christophe Fergeau
d6c5b5c058 syntax-check: Remove trailing whitespace from EOL and EOF
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:46:16 +00:00
Jonathon Jongsma
96e94c6f32 Convert RedChannel hierarchy to GObject
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-25 11:32:13 -05:00
Jonathon Jongsma
bcb8503659 Move CommonGraphicsChannel to a new file
Move out of red-worker.c. This requires a little bit of minor
refactoring to avoid accessing some RedWorker internals in the
constructor function, etc.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-14 11:49:12 +01:00
Jonathon Jongsma
7dd8e8be76 Move CursorChannelClient to separate file
Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 09:38:04 +01:00
Frediano Ziglio
8d25e03371 Add some comments to cursor-channel.h header
Explain usage of the class.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-05-27 09:32:58 +01:00
Frediano Ziglio
1d3cd7d617 Hide CursorChannelClient implementation details
The existence of this class can be hidden to user of CursorChannel class

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-05-26 11:02:53 +01:00
Frediano Ziglio
6ad393d82b Make cursor_channel_client_new static
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-05-26 10:23:35 +01:00
Frediano Ziglio
c0a8b69822 Move cursor_connect to CursorChannel
This function was handling mainly CursorChannel state

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-05-26 10:23:33 +01:00
Frediano Ziglio
597f30d5b7 reduce header dependencies
Avoid to include headers in cursor-channel.h which are only
used by cursor-channel.c

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 14:24:54 +00:00
Christophe Fergeau
705be34b5e Remove CursorItem::group_id
Now that the group_id is known to RedCursorCmd, we don't need to store
it separately in CursorItem.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:16 +00:00
Frediano Ziglio
525cd67be7 server: rename files
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 23:54:32 +00:00
Marc-André Lureau
e601e920bd server: make more of cursor private
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-03 09:07:18 +00:00
Marc-André Lureau
c9e3b058e4 server: make cursor channel private
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-03 09:06:55 +00:00
Marc-André Lureau
fb84cc956f Move pipe item enumerations out of red_worker.h
Move the cursor-specific pipe item types to cursor-channel.h, and the
display-specific types to red_worker.c. Only leave the common
definitions in red_worker.h. This prepares for splitting the display
channel into a separate file.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-02 16:02:23 +00:00
Marc-André Lureau
2d934ed82e Make cursor_channel_disconnect a CursorChannel method
The first argument should be CursorChannel* rather than RedChannel*
since it's essentially a CursorChannel method.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-30 16:56:13 +00:00
Marc-André Lureau
30c9ff7a8f CursorChannel* arg in cursor_channel_client_new()
Instead of passing a CommonChannel* argument, use CursorChannel* since
this function is only valid for CursorChannels.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-30 08:47:56 +00:00
Marc-André Lureau
26005ddb04 Remove unused parameter from cursor_channel_new()
cursor_channel_new() is only called from one location, and always passes
FALSE as the value for the 'migrate' paramater. In addition, this
parameter is not used within the function. Remove it.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-30 08:47:45 +00:00
Marc-André Lureau
070e0fcd63 worker: move some cursor code to cursor-channel.c
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-10-29 09:58:25 +00:00
Marc-André Lureau
5872d0a09c worker: change CursorItem memory allocation
Do not use static allocate space but handle dynamically

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-29 09:35:28 +00:00
Marc-André Lureau
f99fac0f42 server: start separate display/cursor channel headers
Just move some declarations around

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-23 16:32:47 +01:00