From d601b6090348632438834c325006f4729557ad7e Mon Sep 17 00:00:00 2001 From: John Preston <johnprestonmail@gmail.com> Date: Fri, 21 Sep 2018 10:12:53 +0300 Subject: [PATCH] Fix disabled animations dialogs repaint. --- Telegram/SourceFiles/boxes/stickers_box.cpp | 4 +++- Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 9f6846b77..bd2fcabd1 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -659,7 +659,9 @@ void StickersBox::Inner::setInnerFocus() { void StickersBox::Inner::paintEvent(QPaintEvent *e) { Painter p(this); - _a_shifting.step(); + if (_a_shifting.animating()) { + _a_shifting.step(); + } auto clip = e->rect(); auto ms = getms(); diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index c27affb31..908c235e8 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -219,7 +219,9 @@ void DialogsInner::paintRegion(Painter &p, const QRegion ®ion, bool paintingO auto fullWidth = getFullWidth(); auto ms = getms(); if (_state == State::Default) { - _a_pinnedShifting.step(ms, false); + if (_a_pinnedShifting.animating()) { + _a_pinnedShifting.step(ms, false); + } auto rows = shownDialogs(); auto dialogsClip = r; @@ -1006,15 +1008,16 @@ bool DialogsInner::updateReorderPinned(QPoint localPosition) { void DialogsInner::step_pinnedShifting(TimeMs ms, bool timer) { if (anim::Disabled()) { ms += st::stickersRowDuration; - update(); } + auto wasAnimating = false; auto animating = false; auto updateMin = -1; auto updateMax = 0; for (auto i = 0, l = static_cast<int>(_pinnedRows.size()); i != l; ++i) { auto start = _pinnedRows[i].animStartTime; if (start) { + wasAnimating = true; if (updateMin < 0) updateMin = i; updateMax = i; if (start + st::stickersRowDuration > ms && ms >= start) { @@ -1026,7 +1029,7 @@ void DialogsInner::step_pinnedShifting(TimeMs ms, bool timer) { } } } - if (timer) { + if (timer || (wasAnimating && !animating)) { updateReorderIndexGetCount(); if (_draggingIndex >= 0) { if (updateMin < 0 || updateMin > _draggingIndex) {