From bcdfd2150d742d4f07aa19823490fcddb792958a Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 31 May 2021 15:53:15 +0400 Subject: [PATCH] Auto-pin new screencasts. --- Telegram/SourceFiles/calls/group/calls_group_call.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index e823dc0492..4b88c44bdd 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -951,10 +951,15 @@ void GroupCall::markEndpointActive(VideoEndpoint endpoint, bool active) { } void GroupCall::markTrackShown(const VideoEndpoint &endpoint, bool shown) { - if ((shown && _shownVideoTracks.emplace(endpoint).second) - || (!shown && _shownVideoTracks.remove(endpoint))) { + const auto changed = shown + ? _shownVideoTracks.emplace(endpoint).second + : _shownVideoTracks.remove(endpoint); + if (changed) { _videoStreamShownUpdates.fire_copy({ endpoint, shown }); } + if (shown && changed && endpoint.type == VideoEndpointType::Screen) { + pinVideoEndpoint(endpoint); + } } void GroupCall::rejoin() {