From d5a0f4890dfff33da6ce991c666a499a83a9bbdd Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 2 Jan 2024 00:17:15 +0400 Subject: [PATCH] Choose first screen for sharing by default. --- .../calls/group/ui/desktop_capture_choose_source.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Telegram/SourceFiles/calls/group/ui/desktop_capture_choose_source.cpp b/Telegram/SourceFiles/calls/group/ui/desktop_capture_choose_source.cpp index 85fc07502..87ac643d3 100644 --- a/Telegram/SourceFiles/calls/group/ui/desktop_capture_choose_source.cpp +++ b/Telegram/SourceFiles/calls/group/ui/desktop_capture_choose_source.cpp @@ -454,8 +454,10 @@ void ChooseSourceProcess::fillSources() { auto screenIndex = 0; auto windowIndex = 0; + auto firstScreenSelected = false; const auto active = _delegate->chooseSourceActiveDeviceId(); const auto append = [&](const tgcalls::DesktopCaptureSource &source) { + const auto firstScreen = !source.isWindow() && !screenIndex; const auto title = !source.isWindow() ? tr::lng_group_call_screen_title( tr::now, @@ -471,6 +473,10 @@ void ChooseSourceProcess::fillSources() { if (!active.isEmpty() && active.toStdString() == id) { _selected = raw; raw->setActive(true); + } else if (active.isEmpty() && firstScreen) { + _selected = raw; + raw->setActive(true); + firstScreenSelected = true; } _sources.back()->activations( ) | rpl::filter([=] { @@ -489,6 +495,9 @@ void ChooseSourceProcess::fillSources() { for (const auto &source : windowsManager.sources()) { append(source); } + if (firstScreenSelected) { + updateButtonsVisibility(); + } } void ChooseSourceProcess::updateButtonsVisibility() {