diff --git a/Telegram/SourceFiles/history/history_inner_widget.h b/Telegram/SourceFiles/history/history_inner_widget.h index 3649179629..0691e117ff 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.h +++ b/Telegram/SourceFiles/history/history_inner_widget.h @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/rp_widget.h" #include "ui/effects/animations.h" -#include "ui/chat/select_scroll_manager.h" // Has base/timer.h. +#include "ui/dragging_scroll_manager.h" // Has base/timer.h. #include "ui/widgets/tooltip.h" #include "ui/widgets/scroll_area.h" #include "history/view/history_view_top_bar_widget.h" @@ -457,7 +457,7 @@ private: QPoint _touchStart, _touchPrevPos, _touchPos; base::Timer _touchSelectTimer; - Ui::SelectScrollManager _selectScroll; + Ui::DraggingScrollManager _selectScroll; rpl::variable _sharingDisallowed = false; diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.h b/Telegram/SourceFiles/history/view/history_view_list_widget.h index 2ed870cf48..1b682c4580 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.h +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.h @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/rp_widget.h" #include "ui/effects/animations.h" -#include "ui/chat/select_scroll_manager.h" // Has base/timer.h. +#include "ui/dragging_scroll_manager.h" // Has base/timer.h. #include "ui/widgets/tooltip.h" #include "mtproto/sender.h" #include "data/data_messages.h" @@ -635,7 +635,7 @@ private: Ui::Animations::Simple _spoilerOpacity; - Ui::SelectScrollManager _selectScroll; + Ui::DraggingScrollManager _selectScroll; rpl::event_stream _requestedToEditMessage; rpl::event_stream _requestedToReplyToMessage; diff --git a/Telegram/SourceFiles/ui/chat/select_scroll_manager.cpp b/Telegram/SourceFiles/ui/chat/select_scroll_manager.cpp deleted file mode 100644 index 69f4be21bf..0000000000 --- a/Telegram/SourceFiles/ui/chat/select_scroll_manager.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#include "ui/chat/select_scroll_manager.h" - -#include "ui/widgets/scroll_area.h" - -namespace Ui { - -SelectScrollManager::SelectScrollManager() -: _timer([=] { scrollByTimer(); }) { -} - -void SelectScrollManager::scrollByTimer() { - const auto d = (_delta > 0) - ? std::min(_delta * 3 / 20 + 1, kMaxScrollSpeed) - : std::max(_delta * 3 / 20 - 1, -kMaxScrollSpeed); - _scrolls.fire_copy(d); -} - -void SelectScrollManager::checkDeltaScroll( - const QPoint &point, - int top, - int bottom) { - const auto diff = point.y() - top; - _delta = (diff < 0) - ? diff - : (point.y() >= bottom) - ? (point.y() - bottom + 1) - : 0; - if (_delta) { - _timer.callEach(15); - } else { - _timer.cancel(); - } -} - -void SelectScrollManager::cancel() { - _timer.cancel(); -} - -rpl::producer SelectScrollManager::scrolls() { - return _scrolls.events(); -} - -} // namespace Ui diff --git a/Telegram/SourceFiles/ui/chat/select_scroll_manager.h b/Telegram/SourceFiles/ui/chat/select_scroll_manager.h deleted file mode 100644 index 2ef63d2aee..0000000000 --- a/Telegram/SourceFiles/ui/chat/select_scroll_manager.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#pragma once - -#include "base/timer.h" - -namespace Ui { - -class ScrollArea; - -class SelectScrollManager final { -public: - SelectScrollManager(); - - void checkDeltaScroll(const QPoint &point, int top, int bottom); - void cancel(); - - rpl::producer scrolls(); - -private: - void scrollByTimer(); - - base::Timer _timer; - int _delta = 0; - rpl::event_stream _scrolls; - -}; - -} // namespace Ui diff --git a/Telegram/cmake/td_ui.cmake b/Telegram/cmake/td_ui.cmake index 5c558bb573..d944f629a6 100644 --- a/Telegram/cmake/td_ui.cmake +++ b/Telegram/cmake/td_ui.cmake @@ -186,8 +186,6 @@ PRIVATE ui/chat/pinned_bar.h ui/chat/requests_bar.cpp ui/chat/requests_bar.h - ui/chat/select_scroll_manager.cpp - ui/chat/select_scroll_manager.h ui/controls/call_mute_button.cpp ui/controls/call_mute_button.h ui/controls/chat_service_checkbox.cpp diff --git a/Telegram/lib_ui b/Telegram/lib_ui index c7826b8dff..6e6ba5a149 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit c7826b8dff84a54a5a3b5d550492810a5f09680e +Subproject commit 6e6ba5a14947242ae0de3296fd650a3b3338728e