diff --git a/Telegram/SourceFiles/calls/group/calls_group_members.cpp b/Telegram/SourceFiles/calls/group/calls_group_members.cpp index f1557eeed1..0d8e7a198c 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_members.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_members.cpp @@ -1221,28 +1221,38 @@ base::unique_qptr Members::Controller::createRowContextMenu( }); if (const auto real = _call->lookupReal()) { - const auto pinnedEndpoint = _call->videoEndpointPinned() - ? _call->videoEndpointLarge().endpoint - : std::string(); - const auto participant = real->participantByEndpoint(pinnedEndpoint); - if (participant && participant->peer == participantPeer) { - result->addAction( - tr::lng_group_call_context_unpin_camera(tr::now), - [=] { _call->pinVideoEndpoint(VideoEndpoint()); }); - } else if (const auto participant = real->participantByPeer( - participantPeer)) { + const auto participant = real->participantByPeer(participantPeer); + if (participant) { + const auto pinnedEndpoint = _call->videoEndpointPinned() + ? _call->videoEndpointLarge().endpoint + : std::string(); const auto &camera = computeCameraEndpoint(participant); const auto &screen = computeScreenEndpoint(participant); - const auto streamsScreen = _call->streamsVideo(screen); - if (streamsScreen || _call->streamsVideo(camera)) { - const auto callback = [=] { - _call->pinVideoEndpoint(VideoEndpoint{ - participantPeer, - streamsScreen ? screen : camera }); - }; - result->addAction( - tr::lng_group_call_context_pin_camera(tr::now), - callback); + if (_call->streamsVideo(camera)) { + if (pinnedEndpoint == camera) { + result->addAction( + tr::lng_group_call_context_unpin_camera(tr::now), + [=] { _call->pinVideoEndpoint(VideoEndpoint()); }); + } else { + result->addAction( + tr::lng_group_call_context_pin_camera(tr::now), + [=] { _call->pinVideoEndpoint(VideoEndpoint{ + participantPeer, + camera }); }); + } + } + if (_call->streamsVideo(screen)) { + if (pinnedEndpoint == screen) { + result->addAction( + tr::lng_group_call_context_unpin_screen(tr::now), + [=] { _call->pinVideoEndpoint(VideoEndpoint()); }); + } else { + result->addAction( + tr::lng_group_call_context_pin_screen(tr::now), + [=] { _call->pinVideoEndpoint(VideoEndpoint{ + participantPeer, + screen }); }); + } } } } diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp index 8e1701ccf0..2758da5873 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp @@ -976,6 +976,13 @@ void Panel::setupMembers() { ) | rpl::start_with_next([=] { enlargeVideo(); }, _callLifetime); + + _call->videoEndpointPinnedValue( + ) | rpl::filter([=](bool pinned) { + return pinned && (_mode == PanelMode::Default); + }) | rpl::start_with_next([=] { + enlargeVideo(); + }, _callLifetime); } void Panel::enlargeVideo() {