diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index 0a3f8669e..ba706b6f8 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -24,6 +24,7 @@ EmojiPan { iconSkip: pixels; iconWidth: pixels; iconArea: pixels; + bg: color; overBg: color; fadeLeft: icon; fadeRight: icon; @@ -198,6 +199,7 @@ defaultEmojiPan: EmojiPan { iconSkip: 4px; iconWidth: 35px; iconArea: 32px; + bg: emojiPanBg; overBg: emojiPanHover; fadeLeft: icon {{ "fade_horizontal-flip_horizontal", emojiPanCategories }}; fadeRight: icon {{ "fade_horizontal", emojiPanCategories }}; diff --git a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp index e088149da..415e1c87a 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp @@ -395,7 +395,9 @@ EmojiListWidget::EmojiListWidget( , _picker(this) , _showPickerTimer([=] { showPicker(); }) { setMouseTracking(true); - setAttribute(Qt::WA_OpaquePaintEvent); + if (st().bg->c.alpha() > 0) { + setAttribute(Qt::WA_OpaquePaintEvent); + } _customSingleSize = Data::FrameSizeFromTag( Data::CustomEmojiManager::SizeTag::Large @@ -778,7 +780,9 @@ void EmojiListWidget::paintEvent(QPaintEvent *e) { _repaintsScheduled.clear(); const auto clip = e ? e->rect() : rect(); - p.fillRect(clip, st::emojiPanBg); + if (st().bg->c.alpha() > 0) { + p.fillRect(clip, st().bg); + } paint(p, {}, clip); } diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp index ef46a2eb9..627a755c0 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp @@ -181,7 +181,9 @@ int Selector::countWidth(int desiredWidth, int maxWidth) { (maxWidth - 2 * _skipx) / _size); _columns = std::min(possibleColumns, max); _small = (possibleColumns - _columns > 1); - _recentRows = (_strip.count() + _columns - 1) / _columns; + _recentRows = (_reactions.recent.size() + + (_reactions.morePremiumAvailable ? 1 : 0) + + _columns - 1) / _columns; const auto added = (_columns < max || _reactions.customAllowed) ? Strip::AddedButton::Expand : _reactions.morePremiumAvailable @@ -207,10 +209,11 @@ int Selector::extendTopForCategories() const { return _reactions.customAllowed ? st::reactPanelEmojiPan.footer : 0; } -int Selector::desiredHeight() const { - return _reactions.customAllowed - ? st::emojiPanMaxHeight - : (_skipy + _recentRows * _size + _skipBottom); +int Selector::minimalHeight() const { + return _skipy + + (_recentRows * _size) + + st::roundRadiusSmall + + st::reactPanelEmojiPan.padding.bottom(); } void Selector::setSpecialExpandTopSkip(int skip) { @@ -363,7 +366,9 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress) const auto frame = int(base::SafeRound(progress * (kFramesCount - 1))); const auto radiusStart = st::reactStripHeight / 2.; const auto radiusEnd = st::roundRadiusSmall; - const auto radius = radiusStart + progress * (radiusEnd - radiusStart); + const auto radius = _reactions.customAllowed + ? (radiusStart + progress * (radiusEnd - radiusStart)) + : radiusStart; const auto extents = extentsForShadow(); const auto expanding = anim::easeOutCirc(1., progress); const auto expandUp = anim::interpolate(0, _collapsedTopSkip, expanding); @@ -624,6 +629,9 @@ void Selector::createList(not_null controller) { const auto st = lifetime().make_state( st::reactPanelEmojiPan); st->padding.setTop(_skipy); + if (!_reactions.customAllowed) { + st->bg = st::transparent; + } _list = _scroll->setOwnedWidget( object_ptr(_scroll, EmojiListDescriptor{ .session = &controller->session(), @@ -722,9 +730,7 @@ bool AdjustMenuGeometryForSelector( const auto height = menu->height(); const auto fullTop = extents.top() + categoriesTop + extend.top(); const auto minimalHeight = extents.top() - + std::min( - selector->desiredHeight(), - categoriesTop + st::emojiPanMinHeight / 2) + + selector->minimalHeight() + extents.bottom(); const auto willBeHeightWithoutBottomPadding = fullTop + height diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.h b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.h index 5b180ab49..b2f078cd1 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.h +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.h @@ -46,7 +46,7 @@ public: int countWidth(int desiredWidth, int maxWidth); [[nodiscard]] QMargins extentsForShadow() const; [[nodiscard]] int extendTopForCategories() const; - [[nodiscard]] int desiredHeight() const; + [[nodiscard]] int minimalHeight() const; void setSpecialExpandTopSkip(int skip); void initGeometry(int innerTop); diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.cpp index 12e402795..8beec77e7 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.cpp @@ -38,6 +38,7 @@ constexpr auto kHoverScale = 1.24; .json = media->bytes(), .sizeOverride = QSize(size, size), .frame = frame, + .limitFps = true, }); } diff --git a/Telegram/SourceFiles/settings/settings_common.cpp b/Telegram/SourceFiles/settings/settings_common.cpp index ab540f48d..da7d63048 100644 --- a/Telegram/SourceFiles/settings/settings_common.cpp +++ b/Telegram/SourceFiles/settings/settings_common.cpp @@ -268,6 +268,10 @@ LottieIcon CreateLottieIcon( not_null parent, Lottie::IconDescriptor &&descriptor, style::margins padding) { + Expects(!descriptor.frame); // I'm not sure it considers limitFps. + + descriptor.limitFps = true; + auto object = object_ptr(parent); const auto raw = object.data(); diff --git a/Telegram/lib_lottie b/Telegram/lib_lottie index f3563bc6b..d4764ed8b 160000 --- a/Telegram/lib_lottie +++ b/Telegram/lib_lottie @@ -1 +1 @@ -Subproject commit f3563bc6b0e042095d4d667d013f62cb8ae62b65 +Subproject commit d4764ed8bf0ba2309847bca99f7f8b3d58db25b4