On Wed, 2017-08-23 at 10:14 +0100, Frediano Ziglio wrote: > Handle messages from clients. > Some some messages to clients. Do you mean "Send some"? > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > server/stream-channel.c | 41 > ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 40 insertions(+), 1 deletion(-) > > diff --git a/server/stream-channel.c b/server/stream-channel.c > index 804db77d..e2a6e564 100644 > --- a/server/stream-channel.c > +++ b/server/stream-channel.c > @@ -108,6 +108,25 @@ stream_channel_send_item(RedChannelClient *rcc, > RedPipeItem *pipe_item) > red_channel_client_begin_send_message(rcc); > } > > +static bool > +handle_message(RedChannelClient *rcc, uint16_t type, uint32_t size, > void *msg) > +{ > + switch (type) { > + case SPICE_MSGC_DISPLAY_INIT: > + case SPICE_MSGC_DISPLAY_PREFERRED_COMPRESSION: > + return true; > + case SPICE_MSGC_DISPLAY_STREAM_REPORT: > + /* TODO these will help tuning the streaming > reducing/increasing quality */ "tuning" -> "tune" > + return true; > + case SPICE_MSGC_DISPLAY_GL_DRAW_DONE: > + /* client should not send this message */ > + return false; > + default: > + return red_channel_client_handle_message(rcc, type, size, > msg); > + } > +} > + > + > StreamChannel* > stream_channel_new(RedsState *server) > { > @@ -133,6 +152,22 @@ stream_channel_connect(RedChannel *red_channel, > RedClient *red_client, RedsStrea > > client = stream_channel_client_new(channel, red_client, stream, > migration, caps); > spice_return_if_fail(client != NULL); > + > + // TODO set capabilities like SPICE_DISPLAY_CAP_MONITORS_CONFIG > + // see guest_set_client_capabilities > + RedChannelClient *rcc = RED_CHANNEL_CLIENT(client); > + red_channel_client_push_set_ack(rcc); > + > + // TODO what should happen on migration, dcc return if on > migration wait ?? > + red_channel_client_ack_zero_messages_window(rcc); > + > + // "emulate" dcc_start > + // TODO only if "surface" > + red_channel_client_pipe_add_empty_msg(rcc, > SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES); > + // TODO red_surface_create_item_new > + // TODO surface data ?? > + // TODO monitor configs ?? > + red_channel_client_pipe_add_empty_msg(rcc, > SPICE_MSG_DISPLAY_MARK); > } > > static void > @@ -147,6 +182,10 @@ stream_channel_constructed(GObject *object) > client_cbs.connect = stream_channel_connect; > red_channel_register_client_cbs(red_channel, &client_cbs, NULL); > > + // TODO, send monitor to support multiple monitors in the future > +// red_channel_set_cap(red_channel, > SPICE_DISPLAY_CAP_MONITORS_CONFIG); > + red_channel_set_cap(red_channel, > SPICE_DISPLAY_CAP_STREAM_REPORT); > + > reds_register_channel(reds, red_channel); > } > > @@ -159,7 +198,7 @@ stream_channel_class_init(StreamChannelClass > *klass) > object_class->constructed = stream_channel_constructed; > > channel_class->parser = > spice_get_client_channel_parser(SPICE_CHANNEL_DISPLAY, NULL); > - channel_class->handle_message = > red_channel_client_handle_message; > + channel_class->handle_message = handle_message; > > channel_class->on_disconnect = > stream_channel_client_on_disconnect; > channel_class->send_item = stream_channel_send_item; Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel