Commit Graph

26 Commits

Author SHA1 Message Date
Rosen Penev
9462537d24 clang-tidy: fix inconsistent declarations
Found with readability-inconsistent-declaration-parameter-name

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2021-05-09 11:19:30 +01:00
Frediano Ziglio
b174e757fa Enable -Wshadow warning
This flag allows to catch variables or arguments hiding other
variables or attributes.
It helps avoiding some possible mistakes.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-25 09:18:59 +01:00
Frediano Ziglio
21f9d25aa8 Update filenames in comments
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-05-11 08:14:47 +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
54c0830919 input-channels: Improve encapsulation
Update member access to limit it.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
16f89a80fa inputs-channel: Move some methods to protected
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
6444fd6cfe inputs-channel: More C++ on InputsChannel
Removed ugly converts putting in InputsChannelClient::get_channel().
Removed silly accessors.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
9df07e3f20 inputs-channel: Make InputsChannel more encapsulated
Put functions into methods.

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
Frediano Ziglio
52d8dd6898 inputs-channel: Move spice_server_kbd_leds to InputsChannel
This avoids to expose some detail about the channel.
Like other APIs implement it move close to the part that handle
it instead of have everything in reds.c.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-12-19 16:29:41 +00:00
Frediano Ziglio
9575713dfb inputs-channel: Remove reds argument from inputs_channel_set_tablet
All other inputs_channel_set_* functions do not have this
parameter and get it from the channel.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2017-11-27 10:11:53 +00:00
Christophe Fergeau
5dbfbb4d78 channel: Move RedChannel::on_disconnect to RedChannelClient
This vfunc only has a RedChannelClient * argument, and most of the time,
it operates on RedChannelClient, not on RedChannel. Moreover, the only
time it's used is from RedChannelClient. This commit moves the vfunc to
RedChannelClient, which seems like a better fit for it.

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
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
efe49fa275 Use macros for casting Channel types
In preparation for converting RedChannel to GObject, switch to using
RED_CHANNEL()-type macros for casting. For now they just do a regular
cast, but it helps reduce the size of the GObject patch to make it
easier to review.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-14 11:49:25 +01:00
Frediano Ziglio
5d2fb6a897 Avoid getting channel from client
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-05-27 18:02:29 +01:00
Frediano Ziglio
24b3a8e73c Make some function static
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-05-25 15:41:58 +01:00
Jonathon Jongsma
6c4e86cbe3 Move InputsChannelClient to a separate file
Preparation for converting to GObject

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-05-24 14:56:41 -05:00
Frediano Ziglio
f36c3887ba Make sure all headers are independent
Make sure is possible to include any headers alone.

I used this script to check independence (run under server directory):
----
#!/bin/bash

set -e

# check not already modified
if grep -q libheaders.la Makefile.am; then
    echo "Header library already prepared" >&2
    exit 1
fi

add_lib() {
    local hdr="$1"

    hdr=${hdr%.h}
    c="mao_${hdr}.c"
    echo "#include \"${hdr}.h\"" > $c
    echo -e "\t$c \\" >&3
}

# add library to compile all headers alones
exec 3>> Makefile.am
echo "
noinst_LTLIBRARIES += libheaders.la
libheaders_la_SOURCES =				\\" >&3
for hdr in *.h; do
    case $hdr in
    spice-bitmap-utils.h)
        add_lib $hdr
        ;;
    spice*.h)
        ;;
    *)
        add_lib $hdr
        ;;
    esac
done
echo -e "\t\$(NULL)" >&3
exec 3>&-
----

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-05-18 00:24:37 +01:00
Jonathon Jongsma
36b0735192 Add RedsState arg to inputs_channel_new()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12 15:32:47 +00:00
Jonathon Jongsma
cca32779f5 spice_server_kbd_leds: don't use global 'reds'
Store a reference to the RedsState server in the keyboard state struct

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 13:57:35 +00:00
Jonathon Jongsma
b85c8295d6 Remove use of global 'reds' var from spice_server_remove_interface()
Since this is public API, we can't easily change the signature of the
function to take a RedsState argument, so instead we apply a hack and
store the reds argument inside the device state struct when the
interface is added, and retrieve it for use later when it is removed.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-03 08:41:37 +00:00
Jonathon Jongsma
3881abc081 inputs_init() -> inputs_channel_new()
Rename function to be more consistent

Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-28 15:34:53 +00:00
Jonathon Jongsma
ab55619492 Remove global inputs channel
Make the RedsState object own an InputsChannel object rather than
having a global inputs channel. This means changing a lot of
inputs-related API to take an InputsChannel* argument and moving the
keyboard, mouse, and tablet objects into the InputsChannel object.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-28 15:34:52 +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