diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 333512df2..0208dbae3 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -194,13 +194,6 @@ constexpr auto kCommonModifiers = 0 | Qt::ControlModifier; const auto kPsaAboutPrefix = "cloud_lng_about_psa_"; -base::options::toggle AutoScrollInactiveChat({ - .id = kOptionAutoScrollInactiveChat, - .name = "Enable auto-scroll of inactive chat", - .description = "Enable auto-scrolling chat for new messages, " - "even when the window is not in focus.", -}); - [[nodiscard]] rpl::producer ActivePeerValue( not_null controller) { return controller->activeChatValue( @@ -5460,9 +5453,6 @@ int HistoryWidget::countAutomaticScrollTop() { Expects(_list != nullptr); if (const auto unread = _history->firstUnreadMessage()) { - if (AutoScrollInactiveChat.value()) { - return ScrollMax; - } const auto firstUnreadTop = _list->itemTop(unread); const auto possibleUnreadBarTop = _scroll->scrollTopMax() + HistoryView::UnreadBar::height() diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 9f4a94504..d13cf36ac 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -76,6 +76,13 @@ void FeedLangTestingKey(int key) { } } +base::options::toggle AutoScrollInactiveChat({ + .id = kOptionAutoScrollInactiveChat, + .name = "Mark as read of inactive chat", + .description = "Mark new messages as read and scroll the chat " + "even when the window is not in focus.", +}); + } // namespace MainWindow::MainWindow(not_null controller) @@ -538,8 +545,8 @@ bool MainWindow::markingAsRead() const { && !_main->isHidden() && !_main->animatingShow() && !_layer - && isActive() - && !_main->session().updates().isIdle(); + && (AutoScrollInactiveChat().value() + || (isActive() && !_main->session().updates().isIdle())); } void MainWindow::checkActivation() {