From a29acd48822537c90fdbf0be26e8445014f394f3 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sat, 28 Mar 2026 09:45:13 +0300 Subject: [PATCH] Brought non-sprite shadows revolution. --- Telegram/SourceFiles/boxes/url_auth_box.cpp | 4 +++- Telegram/SourceFiles/calls/calls.style | 5 ++--- Telegram/SourceFiles/chat_helpers/chat_helpers.style | 1 - .../SourceFiles/chat_helpers/emoji_list_widget.cpp | 6 ++++-- Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp | 8 +++++--- Telegram/SourceFiles/chat_helpers/tabbed_panel.h | 2 ++ Telegram/SourceFiles/dialogs/dialogs.style | 4 ---- .../history/view/history_view_top_bar_widget.cpp | 4 +++- .../reactions/history_view_reactions_selector.cpp | 9 +++++---- .../info/profile/info_profile_top_bar.cpp | 5 ++++- .../inline_bots/inline_results_widget.cpp | 6 ++++-- .../SourceFiles/inline_bots/inline_results_widget.h | 2 ++ Telegram/SourceFiles/media/view/media_view.style | 7 ++----- Telegram/SourceFiles/menu/menu_send.cpp | 10 +++++----- Telegram/SourceFiles/ui/chat/chat.style | 4 ---- Telegram/SourceFiles/ui/filter_icon_panel.cpp | 12 +++++------- Telegram/SourceFiles/ui/filter_icon_panel.h | 2 ++ Telegram/lib_spellcheck | 2 +- Telegram/lib_ui | 2 +- 19 files changed, 50 insertions(+), 45 deletions(-) diff --git a/Telegram/SourceFiles/boxes/url_auth_box.cpp b/Telegram/SourceFiles/boxes/url_auth_box.cpp index 3fb201ff45..51735b1cdb 100644 --- a/Telegram/SourceFiles/boxes/url_auth_box.cpp +++ b/Telegram/SourceFiles/boxes/url_auth_box.cpp @@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/toast/toast.h" #include "ui/widgets/menu/menu_action.h" #include "ui/widgets/popup_menu.h" +#include "ui/widgets/shadow.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" #include "styles/style_settings.h" @@ -173,7 +174,8 @@ struct SwitchAccountResult { state->menu->popup( widget->mapToGlobal( QPoint( - widget->width() + st.shadow.extend.right(), + widget->width() + + Ui::BoxShadow::ExtendFor(st.shadow).right(), widget->height()))); }); return { diff --git a/Telegram/SourceFiles/calls/calls.style b/Telegram/SourceFiles/calls/calls.style index 15ecfd33c0..10fcaad944 100644 --- a/Telegram/SourceFiles/calls/calls.style +++ b/Telegram/SourceFiles/calls/calls.style @@ -581,15 +581,14 @@ groupCallMenuShadow: Shadow(defaultEmptyShadow) { } groupCallPanelAnimation: PanelAnimation(defaultPanelAnimation) { fadeBg: groupCallMenuBg; - shadow: groupCallMenuShadow; } groupCallPopupMenu: PopupMenu(defaultPopupMenu) { - shadow: groupCallMenuShadow; + shadowFallback: groupCallMenuBg; menu: groupCallMenu; animation: groupCallPanelAnimation; } groupCallPopupMenuWithIcons: PopupMenu(popupMenuWithIcons) { - shadow: groupCallMenuShadow; + shadowFallback: groupCallMenuBg; menu: Menu(groupCallMenu, menuWithIcons) { arrow: icon {{ "menu/submenu_arrow", groupCallMemberNotJoinedStatus }}; } diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index 7c9fb85fad..e1b52b85c4 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -437,7 +437,6 @@ emojiTabs: defaultTabsSlider; emojiCategoryIconTop: 6px; emojiPanAnimation: PanelAnimation(defaultPanelAnimation) { fadeBg: emojiPanBg; - shadow: boxRoundShadow; } emojiPanWidth: 345px; emojiPanMinHeight: 278px; diff --git a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp index 4751cc9507..5bb545d4c0 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp @@ -120,6 +120,7 @@ private: QPoint _innerPosition; Ui::RoundRect _backgroundRect; Ui::RoundRect _overBg; + Ui::BoxShadow _shadow; bool _hiding = false; QPixmap _cache; @@ -150,7 +151,8 @@ EmojiColorPicker::EmojiColorPicker( : RpWidget(parent) , _st(st) , _backgroundRect(st::emojiPanRadius, _st.bg) -, _overBg(st::emojiPanRadius, _st.overBg) { +, _overBg(st::emojiPanRadius, _st.overBg) +, _shadow(_st.showAnimation.shadow) { setMouseTracking(true); } @@ -233,7 +235,7 @@ void EmojiColorPicker::paintEvent(QPaintEvent *e) { p.drawPixmap(0, 0, _cache); return; } - Ui::Shadow::paint(p, inner, width(), _st.showAnimation.shadow); + _shadow.paint(p, inner, st::emojiPanRadius); _backgroundRect.paint(p, inner); const auto skip = topColorAllSkip(); diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp index 3eb69efd0e..713efc1111 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp @@ -70,7 +70,8 @@ TabbedPanel::TabbedPanel( : _ownedSelector.data()) , _heightRatio(st::emojiPanHeightRatio) , _minContentHeight(st::emojiPanMinHeight) -, _maxContentHeight(st::emojiPanMaxHeight) { +, _maxContentHeight(st::emojiPanMaxHeight) +, _shadow(_selector->st().showAnimation.shadow) { Expects(_selector != nullptr); _selector->setParent(this); @@ -253,7 +254,7 @@ void TabbedPanel::paintEvent(QPaintEvent *e) { hideFinished(); } else { if (!_cache.isNull()) _cache = QPixmap(); - Ui::Shadow::paint(p, innerRect(), width(), _selector->st().showAnimation.shadow); + _shadow.paint(p, innerRect(), st::emojiPanRadius); } } @@ -389,7 +390,8 @@ void TabbedPanel::startShowAnimation() { std::move(image), QRect( inner.topLeft() * style::DevicePixelRatio(), - inner.size() * style::DevicePixelRatio())); + inner.size() * style::DevicePixelRatio()), + st::emojiPanRadius); _showAnimation->setCornerMasks(Images::CornersMask(st::emojiPanRadius)); _showAnimation->start(); } diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_panel.h b/Telegram/SourceFiles/chat_helpers/tabbed_panel.h index 97d66e2c71..29c9c43ed2 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_panel.h +++ b/Telegram/SourceFiles/chat_helpers/tabbed_panel.h @@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/animations.h" #include "ui/rp_widget.h" +#include "ui/widgets/shadow.h" #include "base/timer.h" #include "base/object_ptr.h" @@ -124,6 +125,7 @@ private: bool _hiding = false; bool _hideAfterSlide = false; + Ui::BoxShadow _shadow; QPixmap _cache; Ui::Animations::Simple _a_opacity; base::Timer _hideTimer; diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index aa11903d5a..dd5350b054 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -524,10 +524,6 @@ dialogsSearchInDownTop: 15px; dialogsSearchInDown: icon {{ "intro_country_dropdown", windowBoldFg }}; dialogsSearchInDownSkip: 4px; dialogsSearchInMenu: PopupMenu(defaultPopupMenu) { - shadow: boxRoundShadow; - animation: PanelAnimation(defaultPanelAnimation) { - shadow: boxRoundShadow; - } scrollPadding: margins(0px, 0px, 0px, 0px); radius: 8px; menu: menuWithIcons; diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index ec0035847e..b1658feb93 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/buttons.h" #include "ui/widgets/fields/input_field.h" #include "ui/widgets/popup_menu.h" +#include "ui/widgets/shadow.h" #include "ui/widgets/menu/menu_add_action_callback_factory.h" #include "ui/effects/radial_animation.h" #include "ui/boxes/report_box_graphics.h" // Ui::ReportReason @@ -387,7 +388,8 @@ void TopBarWidget::showPeerMenu() { QPoint( width() + st::topBarMenuPosition.x() - + _menu->st().shadow.extend.right(), + + Ui::BoxShadow::ExtendFor( + _menu->st().shadow).right(), st::topBarMenuPosition.y())))); } } 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 eae6db0db1..8ea24cf6ec 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp @@ -359,10 +359,11 @@ int Selector::effectPreviewHeight() const { if (_listMode != ChatHelpers::EmojiListMode::MessageEffects) { return 0; } - return st::previewMenu.shadow.extend.top() + const auto extend = Ui::BoxShadow::ExtendFor(st::previewMenu.shadow); + return extend.top() + HistoryView::Sticker::MessageEffectSize().height() + st::effectPreviewSend.height - + st::previewMenu.shadow.extend.bottom(); + + extend.bottom(); } QMargins Selector::marginsForShadow() const { @@ -802,7 +803,7 @@ void Selector::paintNonTransparentExpandRect( inner.y() + inner.height(), inner.width(), st::lineWidth, - st::defaultPopupMenu.shadow.fallback); + st::defaultPopupMenu.shadowFallback); } void Selector::paintExpanded(QPainter &p) { @@ -1247,7 +1248,7 @@ bool AdjustMenuGeometryForSelector( selector->effectPreviewHeight()); const auto willBeHeightWithoutBottomPadding = fullTop + height - - menu->st().shadow.extend.top(); + - Ui::BoxShadow::ExtendFor(menu->st().shadow).top(); const auto additionalPaddingBottom = (willBeHeightWithoutBottomPadding >= minimalHeight ? 0 diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp index 0364b26c83..fbde7a01c2 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp @@ -85,6 +85,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/labels.h" #include "ui/widgets/menu/menu_add_action_callback_factory.h" #include "ui/widgets/popup_menu.h" +#include "ui/widgets/shadow.h" #include "ui/widgets/tooltip.h" #include "ui/wrap/fade_wrap.h" #include "window/themes/window_theme.h" @@ -1976,7 +1977,9 @@ void TopBar::showTopBarMenu( ? Ui::PopupMenu::ConstrainToParentScreen( _peerMenu, _actionMore->mapToGlobal(QPoint( - _actionMore->width() + _peerMenu->st().shadow.extend.right(), + _actionMore->width() + + Ui::BoxShadow::ExtendFor( + _peerMenu->st().shadow).right(), _actionMore->height() + st::infoProfileTopBarActionMenuSkip))) : QCursor::pos()); } diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp index ac0f500466..39fb2cb755 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp @@ -36,6 +36,7 @@ Widget::Widget( , _api(&_controller->session().mtp()) , _contentMaxHeight(st::emojiPanMaxHeight) , _contentHeight(_contentMaxHeight) +, _shadow(st::emojiPanAnimation.shadow) , _scroll(this, st::inlineBotsScroll) , _innerRounding(Ui::PrepareCornerPixmaps( ImageRoundRadius::Small, @@ -154,7 +155,7 @@ void Widget::paintEvent(QPaintEvent *e) { hideFinished(); } else { if (!_cache.isNull()) _cache = QPixmap(); - if (!_inPanelGrab) Ui::Shadow::paint(p, innerRect(), width(), st::emojiPanAnimation.shadow); + if (!_inPanelGrab) _shadow.paint(p, innerRect(), st::roundRadiusSmall); paintContent(p); } } @@ -241,7 +242,8 @@ void Widget::startShowAnimation() { std::move(image), QRect( inner.topLeft() * style::DevicePixelRatio(), - inner.size() * style::DevicePixelRatio())); + inner.size() * style::DevicePixelRatio()), + st::emojiPanRadius); _showAnimation->setCornerMasks(Images::CornersMask(ImageRoundRadius::Small)); _showAnimation->start(); } diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.h b/Telegram/SourceFiles/inline_bots/inline_results_widget.h index 166287c583..eb191a5361 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.h +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.h @@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/tooltip.h" #include "ui/effects/animations.h" #include "ui/effects/panel_animation.h" +#include "ui/widgets/shadow.h" #include "base/timer.h" #include "mtproto/sender.h" #include "inline_bots/inline_bot_layout_item.h" @@ -140,6 +141,7 @@ private: QPixmap _cache; Ui::Animations::Simple _a_opacity; bool _inPanelGrab = false; + Ui::BoxShadow _shadow; object_ptr _scroll; QPointer _inner; diff --git a/Telegram/SourceFiles/media/view/media_view.style b/Telegram/SourceFiles/media/view/media_view.style index b7963ee346..24f38339e5 100644 --- a/Telegram/SourceFiles/media/view/media_view.style +++ b/Telegram/SourceFiles/media/view/media_view.style @@ -191,10 +191,9 @@ mediaviewMenuShadow: Shadow(defaultEmptyShadow) { } mediaviewPanelAnimation: PanelAnimation(defaultPanelAnimation) { fadeBg: groupCallMenuBg; - shadow: mediaviewMenuShadow; } mediaviewPopupMenu: PopupMenu(defaultPopupMenu) { - shadow: mediaviewMenuShadow; + shadowFallback: groupCallMenuBg; menu: mediaviewMenu; animation: mediaviewPanelAnimation; } @@ -545,10 +544,9 @@ storiesMenu: Menu(defaultMenu) { color: groupCallMenuBgRipple; } } -storiesMenuShadow: mediaviewMenuShadow; storiesMenuAnimation: mediaviewPanelAnimation; storiesPopupMenu: PopupMenu(defaultPopupMenu) { - shadow: storiesMenuShadow; + shadowFallback: groupCallMenuBg; menu: storiesMenu; animation: storiesMenuAnimation; } @@ -775,7 +773,6 @@ storiesComposeControls: ComposeControls(defaultComposeControls) { dropdown: InnerDropdown(emojiSuggestionsDropdown) { animation: PanelAnimation(defaultPanelAnimation) { fadeBg: storiesComposeBg; - shadow: defaultRoundShadow; } bg: storiesComposeBg; } diff --git a/Telegram/SourceFiles/menu/menu_send.cpp b/Telegram/SourceFiles/menu/menu_send.cpp index 6add7bccb9..1e2bb9c495 100644 --- a/Telegram/SourceFiles/menu/menu_send.cpp +++ b/Telegram/SourceFiles/menu/menu_send.cpp @@ -147,6 +147,7 @@ private: QImage _bg; QPoint _itemShift; QRect _iconRect; + Ui::BoxShadow _boxShadow; std::unique_ptr _loading; Ui::Animations::Simple _shownAnimation; @@ -286,7 +287,8 @@ EffectPreview::EffectPreview( st::effectPreviewPromoPadding)) , _bottom(_send ? ((Ui::RpWidget*)_send.get()) : _premiumPromoLabel.get()) , _close(done) -, _actionWithEffect(ComposeActionWithEffect(action, _effectId, done)) { +, _actionWithEffect(ComposeActionWithEffect(action, _effectId, done)) +, _boxShadow(st::previewMenu.animation.shadow) { _chatStyle->apply(_theme.get()); setupGeometry(position); @@ -376,8 +378,7 @@ void EffectPreview::mousePressEvent(QMouseEvent *e) { void EffectPreview::setupGeometry(QPoint position) { const auto parent = parentWidget(); const auto innerSize = HistoryView::Sticker::MessageEffectSize(); - const auto shadow = st::previewMenu.shadow; - const auto extend = shadow.extend; + const auto extend = Ui::BoxShadow::ExtendFor(st::previewMenu.shadow); _inner = QRect(QPoint(extend.left(), extend.top()), innerSize); _bottom->resizeToWidth(_inner.width()); const auto size = _inner.marginsAdded(extend).size() @@ -471,9 +472,8 @@ void EffectPreview::repaintBackground() { _bg.fill(Qt::transparent); auto p = QPainter(&_bg); - const auto &shadow = st::previewMenu.animation.shadow; const auto shadowed = QRect(_inner.topLeft(), inner); - Ui::Shadow::paint(p, shadowed, width(), shadow); + _boxShadow.paint(p, shadowed, st::previewMenu.radius); p.drawImage(_inner.topLeft(), bg); } diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index ad311944dd..d6314a68a1 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -1155,10 +1155,6 @@ previewMenu: PopupMenu(defaultPopupMenu) { } maxHeight: 420px; radius: boxRadius; - shadow: boxRoundShadow; - animation: PanelAnimation(defaultPanelAnimation) { - shadow: boxRoundShadow; - } } previewTop: PeerListItem(defaultPeerListItem) { height: 52px; diff --git a/Telegram/SourceFiles/ui/filter_icon_panel.cpp b/Telegram/SourceFiles/ui/filter_icon_panel.cpp index cccd148e38..031146c127 100644 --- a/Telegram/SourceFiles/ui/filter_icon_panel.cpp +++ b/Telegram/SourceFiles/ui/filter_icon_panel.cpp @@ -71,7 +71,8 @@ constexpr auto kIcons = std::array{ FilterIconPanel::FilterIconPanel(QWidget *parent) : RpWidget(parent) , _inner(Ui::CreateChild(this)) -, _innerBg(ImageRoundRadius::Small, st::dialogsBg) { +, _innerBg(ImageRoundRadius::Small, st::dialogsBg) +, _shadow(st::emojiPanAnimation.shadow) { setup(); } @@ -276,11 +277,7 @@ void FilterIconPanel::paintEvent(QPaintEvent *e) { hideFinished(); } else { if (!_cache.isNull()) _cache = QPixmap(); - Ui::Shadow::paint( - p, - innerRect(), - width(), - st::emojiPanAnimation.shadow); + _shadow.paint(p, innerRect(), st::emojiPanRadius); } } @@ -381,7 +378,8 @@ void FilterIconPanel::startShowAnimation() { std::move(image), QRect( inner.topLeft() * style::DevicePixelRatio(), - inner.size() * style::DevicePixelRatio())); + inner.size() * style::DevicePixelRatio()), + st::emojiPanRadius); _showAnimation->setCornerMasks(Images::CornersMask(ImageRoundRadius::Small)); _showAnimation->start(); } diff --git a/Telegram/SourceFiles/ui/filter_icon_panel.h b/Telegram/SourceFiles/ui/filter_icon_panel.h index 99caea7a69..774dce8334 100644 --- a/Telegram/SourceFiles/ui/filter_icon_panel.h +++ b/Telegram/SourceFiles/ui/filter_icon_panel.h @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/rp_widget.h" #include "ui/effects/animations.h" #include "ui/round_rect.h" +#include "ui/widgets/shadow.h" namespace Ui { @@ -78,6 +79,7 @@ private: std::unique_ptr _showAnimation; Ui::Animations::Simple _a_show; + Ui::BoxShadow _shadow; bool _hiding = false; QPixmap _cache; Ui::Animations::Simple _a_opacity; diff --git a/Telegram/lib_spellcheck b/Telegram/lib_spellcheck index 476bb43025..98fb380701 160000 --- a/Telegram/lib_spellcheck +++ b/Telegram/lib_spellcheck @@ -1 +1 @@ -Subproject commit 476bb43025449ccbd815a14895e9321695a1a177 +Subproject commit 98fb380701a1342dc913c4835f2f6683993fde5d diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 64145fe6ff..24321da57f 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 64145fe6ffe9a46429153471cc815b5a9315d0e7 +Subproject commit 24321da57f6bba68828e487bd539fc67d82c2753