diff --git a/ui/widgets/labels.cpp b/ui/widgets/labels.cpp index a6a8fac..902b9c4 100644 --- a/ui/widgets/labels.cpp +++ b/ui/widgets/labels.cpp @@ -962,6 +962,9 @@ void FlatLabel::paintEvent(QPaintEvent *e) { : _st.maxHeight ? qMax(_st.maxHeight / lineHeight, 1) : ((height() / lineHeight) + 2); + const auto paused = _animationsPausedCallback + ? _animationsPausedCallback() + : WhichAnimationsPaused::None; _text.draw(p, { .position = { textLeft, _st.margin.top() }, .availableWidth = textWidth, @@ -970,6 +973,10 @@ void FlatLabel::paintEvent(QPaintEvent *e) { .palette = &_st.palette, .spoiler = Text::DefaultSpoilerCache(), .now = crl::now(), + .pausedEmoji = (paused == WhichAnimationsPaused::CustomEmoji + || paused == WhichAnimationsPaused::All), + .pausedSpoiler = (paused == WhichAnimationsPaused::Spoiler + || paused == WhichAnimationsPaused::All), .selection = selection, .elisionLines = lines, .elisionBreakEverywhere = renderElided && _breakEverywhere, diff --git a/ui/widgets/labels.h b/ui/widgets/labels.h index 11735e8..fe0bf3c 100644 --- a/ui/widgets/labels.h +++ b/ui/widgets/labels.h @@ -94,7 +94,6 @@ private: }; class FlatLabel : public RpWidget, public ClickHandlerHost { - public: FlatLabel( QWidget *parent, @@ -130,6 +129,15 @@ public: void setContextCopyText(const QString ©Text); void setBreakEverywhere(bool breakEverywhere); void setTryMakeSimilarLines(bool tryMakeSimilarLines); + enum class WhichAnimationsPaused { + None, + CustomEmoji, + Spoiler, + All, + }; + void setAnimationsPausedCallback(Fn callback) { + _animationsPausedCallback = std::move(callback); + } int naturalWidth() const override; QMargins getMargins() const override; @@ -251,6 +259,7 @@ private: QString _contextCopyText; ClickHandlerFilter _clickHandlerFilter; + Fn _animationsPausedCallback; // text selection and context menu by touch support (at least Windows Surface tablets) bool _touchSelect = false;