Blame SOURCES/0015-stream-channel-Do-not-show-an-empty-blank-screen-on-.patch

ad1357
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
ad1357
From: Frediano Ziglio <fziglio@redhat.com>
ad1357
Date: Sat, 21 Jan 2017 09:01:18 +0000
ad1357
Subject: [spice-server] stream-channel: Do not show an empty blank screen on
ad1357
 start
ad1357
ad1357
Start showing something when we have a surface and stream
ad1357
instead of showing a blank screen which is now not useful.
ad1357
Was useful for debugging purposes to understand that the
ad1357
new channel was sending messages correctly to client and
ad1357
client could handle them.
ad1357
ad1357
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
ad1357
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
ad1357
---
ad1357
 server/stream-channel.c | 16 ++++++++++++----
ad1357
 1 file changed, 12 insertions(+), 4 deletions(-)
ad1357
ad1357
diff --git a/server/stream-channel.c b/server/stream-channel.c
ad1357
index 2ad9ebae3..e89563b82 100644
ad1357
--- a/server/stream-channel.c
ad1357
+++ b/server/stream-channel.c
ad1357
@@ -360,8 +360,13 @@ stream_channel_connect(RedChannel *red_channel, RedClient *red_client, RedsStrea
ad1357
     red_channel_client_ack_zero_messages_window(rcc);
ad1357
 
ad1357
     // "emulate" dcc_start
ad1357
-    // TODO only if "surface"
ad1357
     red_channel_client_pipe_add_empty_msg(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES);
ad1357
+
ad1357
+    // only if "surface"
ad1357
+    if (channel->width == 0 || channel->height == 0) {
ad1357
+        return;
ad1357
+    }
ad1357
+
ad1357
     // pass proper data
ad1357
     red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_SURFACE_CREATE);
ad1357
     // surface data
ad1357
@@ -407,8 +412,8 @@ static void
ad1357
 stream_channel_init(StreamChannel *channel)
ad1357
 {
ad1357
     channel->stream_id = -1;
ad1357
-    channel->width = 1024;
ad1357
-    channel->height = 768;
ad1357
+    channel->width = 0;
ad1357
+    channel->height = 0;
ad1357
 }
ad1357
 
ad1357
 void
ad1357
@@ -421,11 +426,14 @@ stream_channel_change_format(StreamChannel *channel, const StreamMsgFormat *fmt)
ad1357
 
ad1357
     // send new create surface if required
ad1357
     if (channel->width != fmt->width || channel->height != fmt->height) {
ad1357
+        if (channel->width != 0 && channel->height != 0) {
ad1357
+            red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_SURFACE_DESTROY);
ad1357
+        }
ad1357
         channel->width = fmt->width;
ad1357
         channel->height = fmt->height;
ad1357
-        red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_SURFACE_DESTROY);
ad1357
         red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_SURFACE_CREATE);
ad1357
         // TODO monitors config ??
ad1357
+        red_channel_pipes_add_empty_msg(red_channel, SPICE_MSG_DISPLAY_MARK);
ad1357
     }
ad1357
 
ad1357
     // allocate a new stream id