Beta version 4.5.4: Mark-as-read-inactive setting.

In case an experimental setting of auto-scrolling is enabled,
just ignore the window activity check in marking chat as read..
This commit is contained in:
John Preston 2023-01-10 15:31:10 +04:00
parent 2efe409c60
commit 3c17fab15a
2 changed files with 9 additions and 12 deletions

View file

@ -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<PeerData*> ActivePeerValue(
not_null<Window::SessionController*> 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()

View file

@ -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<Window::Controller*> 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() {