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

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