Commit Graph

19 Commits

Author SHA1 Message Date
Christophe Fergeau
722ad4c76b Remove red_channel_set_data()
It's always called at the same time as red_channel_register_client_cbs()
and the data is used by the callbacks, so we can pass the data as an
argument to red_channel_register_client_cbs().

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-17 18:54:52 +00:00
Christophe Fergeau
a653044011 Rename red_channel_pipe_item_init to pipe_item_init
The RedChannel argument is not used by pipe_item_init. Removing it
will make code simpler in places where we don't have a RedChannel
directly available.
This is acting on a PipeItem object so correct name is pipe_item_init.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-10 11:36:52 +00:00
Christophe Fergeau
55b9478b9c Make use of the new reds_core_timer_* API
This makes the code more readable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-03 16:56:07 +00:00
Jonathon Jongsma
bc5c07a881 Add red_channel_get_server()
Instead of poking into the internals of the RedChannel, provide an
accessor.

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:54:03 +00: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
dc4051fb9a Store a reference to RedsState in Channel base class
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12 15:27:03 +00:00
Jonathon Jongsma
127e3ad191 Add RedsState arg to activate_modifiers_watch()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 13:57:44 +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
2726e04a9a Move 'core' into RedsState struct
Also add reds_get_core_interface() accessor for external use.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 11:55:30 +00:00
Jonathon Jongsma
4b228d5c1f Move agent_mouse to RedsState struct
Required adding a RedsState arg to reds_get_agent_mouse()

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-04 08:55:43 +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
deb6afc325 Move vdagent to RedsState struct
Also change API of reds_has_vdagent() to take RedsState arg.  Removes
another global variable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 14:05:36 +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
Jonathon Jongsma
3ead546abb Change some functions to take RedsState arg
In preparation for getting rid of the global 'reds' variable, we need to
pass the RedsState variable to all functions where it is needed. For now
the callers just pass in the global reds variable.

Functions changed:
- vdi_port_read_buf_process;
- vdi_port_read_buf_get;
- vdi_port_read_buf_unref;
- reds_handle_agent_mouse_event;
- reds_num_of_channels;
- reds_num_of_clients;
- reds_fill_channels;
- reds_on_main_agent_start;
- reds_get_agent_data_buffer;
- reds_release_agent_data_buffer;
- reds_client_monitors_config_cleanup;
- red_on_main_agent_data.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-19 14:11:54 +00:00
Jonathon Jongsma
07297dd3d0 Change some functions to take RedsState arg
In preparation for getting rid of the global 'reds' variable, we need to
pass the RedsState variable to all functions where it is needed. For now
the callers just pass in the global reds variable.

Functions changed:
- reds_register_channel;
- reds_unregister_channel;
- reds_get_mouse_mode;
- reds_set_mouse_mode;
- reds_update_mouse_mode;
- reds_agent_remove;
- reds_find_channel;
- reds_mig_cleanup;
- reds_reset_vdp;
- reds_main_channel_connected;
- reds_client_disconnect;
- reds_disconnect;
- reds_mig_disconnect.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-18 16:01:12 +00:00
Frediano Ziglio
ba175f9be1 channel: add interface parameters to SpiceCoreInterfaceInternal
This patch and previous ones want to solve the problem of not having a
context in SpiceCoreInterface. SpiceCoreInterface defines a set of
callbacks to handle events in spice-server. These callbacks allow to
handle timers, watch for file descriptors and send channel events.
All these callbacks do not accept a context (usually in C passed as a
void* parameter) so it is hard for them to differentiate the interface
specified.
Unfortunately this structure is used even internally from different
contexts for instance every RedWorker thread has a different context. To
solve this issue some workarounds are used. Currently for timers a variable
depending on the current thread is used while for watches the opaque
parameter to pass to the event callback is used as it currently points just
to RedChannelClient structure.  This however imposes some implicit
maintainance problem in the future. What happens for instance if for some
reason a timer is registered during worker initialization, run in another
thread? What if we decide to register a file descriptor callback for
something not a RedChannelClient?  Could be that the program will run
without any issue till some bytes change and weird things could happen.

The implementation of this solution is done implementing an internal "core"
interface that has context specific and use it to differentiate the
context instead of relying on some other, hard to maintain, detail. Then an
adapter structure (name inpired to the adapter pattern) will provide the
internal core interface using the external, public, definition (in the
future this technique can be used to extend the external interface without
breaking the ABI).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-11 16:40:17 +00:00
Francois Gouget
8bddb1444e server: Add time constants to go with spice_get_monotonic_time_ms()
They clarify the time unit being used and simplify calculations.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-12-14 11:24:47 +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