diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index b9fcc8a98..3b6f213ec 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -31,6 +31,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "styles/style_history.h" #include "styles/style_boxes.h" #include "media/media_clip_reader.h" +#include "mainwindow.h" namespace { @@ -330,7 +331,8 @@ void SendFilesBox::paintEvent(QPaintEvent *e) { } if (_gifPreview && _gifPreview->started()) { auto s = QSize(_previewWidth, _previewHeight); - auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, ImageRoundCorner::None, getms()); + auto paused = App::wnd()->isGifPausedAtLeastFor(Window::GifPauseReason::Layer); + auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, ImageRoundCorner::None, paused ? 0 : getms()); p.drawPixmap(_previewLeft, st::boxPhotoPadding.top(), frame); } else { p.drawPixmap(_previewLeft, st::boxPhotoPadding.top(), _preview); @@ -671,7 +673,8 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) { } if (_gifPreview && _gifPreview->started()) { auto s = QSize(_thumbw, _thumbh); - auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, ImageRoundCorner::None, getms()); + auto paused = App::wnd()->isGifPausedAtLeastFor(Window::GifPauseReason::Layer); + auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, ImageRoundCorner::None, paused ? 0 : getms()); p.drawPixmap(_thumbx, st::boxPhotoPadding.top(), frame); } else { p.drawPixmap(_thumbx, st::boxPhotoPadding.top(), _thumb); diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index 220f5b7ce..549a9372a 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -251,13 +251,6 @@ bool isMediaViewShown() { return false; } -bool isInlineItemBeingChosen() { - if (auto main = App::main()) { - return main->ui_isInlineItemBeingChosen(); - } - return false; -} - void repaintHistoryItem(const HistoryItem *item) { if (auto main = App::main()) { main->ui_repaintHistoryItem(item); @@ -364,10 +357,6 @@ void migrateUpdated(PeerData *peer) { if (MainWidget *m = App::main()) m->notify_migrateUpdated(peer); } -void clipStopperHidden(ClipStopperType type) { - if (MainWidget *m = App::main()) m->notify_clipStopperHidden(type); -} - void historyItemLayoutChanged(const HistoryItem *item) { if (MainWidget *m = App::main()) m->notify_historyItemLayoutChanged(item); } diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index b08ceff1b..228ed04d3 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -106,7 +106,6 @@ void hideLayer(bool fast = false); void hideSettingsAndLayer(bool fast = false); bool isLayerShown(); bool isMediaViewShown(); -bool isInlineItemBeingChosen(); void repaintHistoryItem(const HistoryItem *item); void autoplayMediaInlineAsync(const FullMsgId &msgId); @@ -175,8 +174,6 @@ bool switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot = void migrateUpdated(PeerData *peer); -void clipStopperHidden(ClipStopperType type); - void historyItemLayoutChanged(const HistoryItem *item); void historyMuteUpdated(History *history); diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index 8481247df..a411a9e69 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -1844,8 +1844,8 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM auto roundCorners = inWebPage ? ImageRoundCorner::All : ((isBubbleTop() ? (ImageRoundCorner::TopLeft | ImageRoundCorner::TopRight) : ImageRoundCorner::None) | ((isBubbleBottom() && _caption.isEmpty()) ? (ImageRoundCorner::BottomLeft | ImageRoundCorner::BottomRight) : ImageRoundCorner::None)); if (animating) { - auto pauseGif = (Ui::isLayerShown() || Ui::isMediaViewShown() || Ui::isInlineItemBeingChosen() || !App::wnd()->isActive()); - p.drawPixmap(rthumb.topLeft(), _gif->current(_thumbw, _thumbh, width, height, roundRadius, roundCorners, pauseGif ? 0 : ms)); + auto paused = App::wnd()->isGifPausedAtLeastFor(Window::GifPauseReason::Any); + p.drawPixmap(rthumb.topLeft(), _gif->current(_thumbw, _thumbh, width, height, roundRadius, roundCorners, paused ? 0 : ms)); } else { p.drawPixmap(rthumb.topLeft(), _data->thumb->pixBlurredSingle(_thumbw, _thumbh, width, height, roundRadius, roundCorners)); } diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 63f6a9b13..446288a71 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -169,6 +169,11 @@ HistoryInner::HistoryInner(HistoryWidget *historyWidget, Ui::ScrollArea *scroll, subscribe(Global::RefItemRemoved(), [this](HistoryItem *item) { itemRemoved(item); }); + subscribe(App::wnd()->gifPauseLevelChanged(), [this] { + if (!App::wnd()->isGifPausedAtLeastFor(Window::GifPauseReason::Any)) { + update(); + } + }); } void HistoryInner::messagesReceived(PeerData *peer, const QVector &messages) { @@ -3828,10 +3833,6 @@ void HistoryWidget::notify_migrateUpdated(PeerData *peer) { } } -void HistoryWidget::notify_clipStopperHidden(ClipStopperType type) { - if (_list) _list->update(); -} - bool HistoryWidget::cmd_search() { if (!inFocusChain() || !_peer) return false; @@ -7164,11 +7165,6 @@ void HistoryWidget::onUpdateHistoryItems() { } } -bool HistoryWidget::ui_isInlineItemBeingChosen() { - return _emojiPanel->ui_isInlineItemBeingChosen() - || (_inlineResults && _inlineResults->ui_isInlineItemBeingChosen()); -} - PeerData *HistoryWidget::ui_getPeerForMouseAction() { return _peer; } diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index ac29982b6..7ae9dd429 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -716,7 +716,6 @@ public: void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col); void ui_repaintHistoryItem(const HistoryItem *item); - bool ui_isInlineItemBeingChosen(); PeerData *ui_getPeerForMouseAction(); void notify_historyItemLayoutChanged(const HistoryItem *item); @@ -727,7 +726,6 @@ public: bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo); void notify_userIsBotChanged(UserData *user); void notify_migrateUpdated(PeerData *peer); - void notify_clipStopperHidden(ClipStopperType type); void notify_handlePendingHistoryUpdate(); bool cmd_search(); diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp index 20319a8fa..472cc614c 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp @@ -160,7 +160,8 @@ void Gif::paint(Painter &p, const QRect &clip, const PaintContext *context) cons QRect r(0, 0, _width, height); if (animating) { if (!_thumb.isNull()) _thumb = QPixmap(); - p.drawPixmap(r.topLeft(), _gif->current(frame.width(), frame.height(), _width, height, ImageRoundRadius::None, ImageRoundCorner::None, context->paused ? 0 : context->ms)); + auto pixmap = _gif->current(frame.width(), frame.height(), _width, height, ImageRoundRadius::None, ImageRoundCorner::None, context->paused ? 0 : context->ms); + p.drawPixmap(r.topLeft(), pixmap); } else { prepareThumb(_width, height, frame); if (_thumb.isNull()) { diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp index d49298596..001570377 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp @@ -60,11 +60,11 @@ Inner::Inner(QWidget *parent) : TWidget(parent) { subscribe(AuthSession::CurrentDownloaderTaskFinished(), [this] { update(); }); -} - -void Inner::setMaxHeight(int maxHeight) { - _maxHeight = maxHeight; - resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, countHeight()); + subscribe(App::wnd()->gifPauseLevelChanged(), [this] { + if (!App::wnd()->isGifPausedAtLeastFor(Window::GifPauseReason::InlineResults)) { + update(); + } + }); } void Inner::setVisibleTopBottom(int visibleTop, int visibleBottom) { @@ -107,7 +107,7 @@ void Inner::paintInlineItems(Painter &p, const QRect &r) { p.drawText(QRect(0, 0, width(), (height() / 3) * 2 + st::normalFont->height), lang(lng_inline_bot_no_results), style::al_center); return; } - auto gifPaused = Ui::isLayerShown() || Ui::isMediaViewShown() || _previewShown || !App::wnd()->isActive(); + auto gifPaused = App::wnd()->isGifPausedAtLeastFor(Window::GifPauseReason::InlineResults); InlineBots::Layout::PaintContext context(getms(), false, gifPaused, false); auto top = st::stickerPanPadding; @@ -547,10 +547,6 @@ bool Inner::inlineItemVisible(const ItemBase *layout) { return (top < _visibleTop + _maxHeight) && (top + _rows[row].items[col]->height() > _visibleTop); } -bool Inner::ui_isInlineItemBeingChosen() { - return true; -} - void Inner::updateSelected() { if (_pressed >= 0 && !_previewShown) { return; @@ -890,6 +886,8 @@ Widget::~Widget() = default; void Widget::hideFinished() { hide(); + App::wnd()->disableGifPauseReason(Window::GifPauseReason::InlineResults); + _inner->hideFinish(true); _a_show.finish(); _showAnimation.reset(); @@ -898,8 +896,6 @@ void Widget::hideFinished() { _hiding = false; _scroll->scrollToY(0); - - Notify::clipStopperHidden(ClipStopperSavedGifsPanel); } void Widget::showAnimated() { @@ -912,19 +908,13 @@ void Widget::showStarted() { _inner->preloadImages(); moveByBottom(); show(); + App::wnd()->enableGifPauseReason(Window::GifPauseReason::InlineResults); startShowAnimation(); } else if (_hiding) { startOpacityAnimation(false); } } -bool Widget::ui_isInlineItemBeingChosen() { - if (!isHidden()) { - return _inner->ui_isInlineItemBeingChosen(); - } - return false; -} - void Widget::onScroll() { auto st = _scroll->scrollTop(); if (st + _scroll->height() > _scroll->scrollTopMax()) { diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.h b/Telegram/SourceFiles/inline_bots/inline_results_widget.h index 09b869217..a67e8be53 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.h +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.h @@ -77,7 +77,6 @@ public: void inlineItemLayoutChanged(const ItemBase *layout) override; void inlineItemRepaint(const ItemBase *layout) override; bool inlineItemVisible(const ItemBase *layout) override; - bool ui_isInlineItemBeingChosen(); int countHeight(bool plain = false); @@ -179,8 +178,6 @@ public: bool overlaps(const QRect &globalRect) const; - bool ui_isInlineItemBeingChosen(); - void showAnimated(); void hideAnimated(); diff --git a/Telegram/SourceFiles/layerwidget.cpp b/Telegram/SourceFiles/layerwidget.cpp index 7c76cbdbe..6c43a0be4 100644 --- a/Telegram/SourceFiles/layerwidget.cpp +++ b/Telegram/SourceFiles/layerwidget.cpp @@ -537,6 +537,7 @@ void LayerStackWidget::showBox(object_ptr box) { void LayerStackWidget::prepareForAnimation() { if (isHidden()) { show(); + App::wnd()->enableGifPauseReason(Window::GifPauseReason::Layer); } if (_mainMenu) { _mainMenu->hide(); @@ -565,6 +566,7 @@ void LayerStackWidget::animationDone() { } if (hidden) { App::wnd()->layerFinishedHide(this); + App::wnd()->disableGifPauseReason(Window::GifPauseReason::Layer); } else { showFinished(); } @@ -734,6 +736,7 @@ void MediaPreviewWidget::paintEvent(QPaintEvent *e) { if (!_a_shown.animating()) { if (_hiding) { hide(); + App::wnd()->disableGifPauseReason(Window::GifPauseReason::MediaPreview); return; } } else { @@ -788,7 +791,10 @@ void MediaPreviewWidget::showPreview(PhotoData *photo) { void MediaPreviewWidget::startShow() { _cache = QPixmap(); if (isHidden() || _a_shown.animating()) { - if (isHidden()) show(); + if (isHidden()) { + show(); + App::wnd()->enableGifPauseReason(Window::GifPauseReason::MediaPreview); + } _hiding = false; _a_shown.start([this] { update(); }, 0., 1., st::stickerPreviewDuration); } else { @@ -920,8 +926,9 @@ QPixmap MediaPreviewWidget::currentImage() const { } } if (_gif && _gif->started()) { - QSize s = currentDimensions(); - return _gif->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, ImageRoundCorner::None, getms()); + auto s = currentDimensions(); + auto paused = App::wnd()->isGifPausedAtLeastFor(Window::GifPauseReason::MediaPreview); + return _gif->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, ImageRoundCorner::None, paused ? 0 : getms()); } if (_cacheStatus != CacheThumbLoaded && _document->thumb->loaded()) { QSize s = currentDimensions(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 1fa4fa648..115f0914f 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -540,10 +540,6 @@ void MainWidget::notify_migrateUpdated(PeerData *peer) { _history->notify_migrateUpdated(peer); } -void MainWidget::notify_clipStopperHidden(ClipStopperType type) { - _history->notify_clipStopperHidden(type); -} - void MainWidget::ui_repaintHistoryItem(const HistoryItem *item) { _history->ui_repaintHistoryItem(item); if (item->history()->lastMsg == item) { @@ -554,10 +550,6 @@ void MainWidget::ui_repaintHistoryItem(const HistoryItem *item) { if (_overview) _overview->ui_repaintHistoryItem(item); } -bool MainWidget::ui_isInlineItemBeingChosen() { - return _history->ui_isInlineItemBeingChosen(); -} - void MainWidget::notify_historyItemLayoutChanged(const HistoryItem *item) { _history->notify_historyItemLayoutChanged(item); if (_overview) _overview->notify_historyItemLayoutChanged(item); diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index caac06788..90ed7844d 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -383,7 +383,6 @@ public: void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col); void ui_repaintHistoryItem(const HistoryItem *item); - bool ui_isInlineItemBeingChosen(); void ui_showPeerHistory(quint64 peer, qint32 msgId, Ui::ShowWay way); PeerData *ui_getPeerForMouseAction(); @@ -395,7 +394,6 @@ public: void notify_userIsBotChanged(UserData *bot); void notify_userIsContactChanged(UserData *user, bool fromThisApp); void notify_migrateUpdated(PeerData *peer); - void notify_clipStopperHidden(ClipStopperType type); void notify_historyItemLayoutChanged(const HistoryItem *item); void notify_historyMuteUpdated(History *history); void notify_handlePendingHistoryUpdate(); diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index f6ef89a4c..08f919647 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -2662,7 +2662,6 @@ void MediaView::setVisible(bool visible) { stopGif(); destroyThemePreview(); _radial.stop(); - Notify::clipStopperHidden(ClipStopperMediaview); } } @@ -2903,6 +2902,6 @@ void MediaView::updateHeader() { } float64 MediaView::overLevel(OverState control) const { - ShowingOpacities::const_iterator i = _animOpacities.constFind(control); + auto i = _animOpacities.constFind(control); return (i == _animOpacities.cend()) ? (_over == control ? 1 : 0) : i->current(); } diff --git a/Telegram/SourceFiles/stickers/emoji_panel.cpp b/Telegram/SourceFiles/stickers/emoji_panel.cpp index 75b631b84..8d3ecfd49 100644 --- a/Telegram/SourceFiles/stickers/emoji_panel.cpp +++ b/Telegram/SourceFiles/stickers/emoji_panel.cpp @@ -688,8 +688,6 @@ void EmojiPanel::hideFinished() { _hiding = false; scrollToY(0); - - Notify::clipStopperHidden(ClipStopperSavedGifsPanel); } void EmojiPanel::showAnimated() { @@ -745,10 +743,6 @@ void EmojiPanel::setInlineQueryPeer(PeerData *peer) { gifs()->setInlineQueryPeer(peer); } -bool EmojiPanel::ui_isInlineItemBeingChosen() { - return (_currentTabType == TabType::Gifs && !isHidden()); -} - void EmojiPanel::showAll() { currentTab()->footer()->show(); _scroll->show(); @@ -827,9 +821,6 @@ void EmojiPanel::switchTab() { currentTab()->returnWidget(std::move(widget)); _currentTabType = newTabType; - if (_currentTabType == TabType::Gifs) { - Notify::clipStopperHidden(ClipStopperSavedGifsPanel); - } currentTab()->widget()->refreshRecent(); currentTab()->widget()->preloadImages(); setWidgetToScrollArea(); diff --git a/Telegram/SourceFiles/stickers/emoji_panel.h b/Telegram/SourceFiles/stickers/emoji_panel.h index de67c29e3..b9945a196 100644 --- a/Telegram/SourceFiles/stickers/emoji_panel.h +++ b/Telegram/SourceFiles/stickers/emoji_panel.h @@ -62,8 +62,6 @@ public: bool overlaps(const QRect &globalRect) const; void setInlineQueryPeer(PeerData *peer); - bool ui_isInlineItemBeingChosen(); - void showAnimated(); void hideAnimated(); diff --git a/Telegram/SourceFiles/stickers/gifs_list_widget.cpp b/Telegram/SourceFiles/stickers/gifs_list_widget.cpp index 2223c951c..d35fabb41 100644 --- a/Telegram/SourceFiles/stickers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/stickers/gifs_list_widget.cpp @@ -131,6 +131,11 @@ GifsListWidget::GifsListWidget(QWidget *parent) : Inner(parent) subscribe(AuthSession::CurrentDownloaderTaskFinished(), [this] { update(); }); + subscribe(App::wnd()->gifPauseLevelChanged(), [this] { + if (!App::wnd()->isGifPausedAtLeastFor(Window::GifPauseReason::SavedGifs)) { + update(); + } + }); } object_ptr GifsListWidget::createFooter() { @@ -240,7 +245,7 @@ void GifsListWidget::paintInlineItems(Painter &p, QRect clip) { p.drawText(QRect(0, 0, width(), (height() / 3) * 2 + st::normalFont->height), lang(lng_inline_bot_no_results), style::al_center); return; } - auto gifPaused = Ui::isLayerShown() || Ui::isMediaViewShown() || _previewShown || !App::wnd()->isActive(); + auto gifPaused = App::wnd()->isGifPausedAtLeastFor(Window::GifPauseReason::SavedGifs); InlineBots::Layout::PaintContext context(getms(), false, gifPaused, false); auto top = st::stickerPanPadding; @@ -375,6 +380,7 @@ EmojiPanel::InnerFooter *GifsListWidget::getFooter() const { void GifsListWidget::processHideFinished() { clearSelection(); + App::wnd()->disableGifPauseReason(Window::GifPauseReason::SavedGifs); } void GifsListWidget::processPanelHideFinished() { @@ -735,6 +741,7 @@ void GifsListWidget::afterShown() { if (_footer) { _footer->stealFocus(); } + App::wnd()->enableGifPauseReason(Window::GifPauseReason::SavedGifs); } void GifsListWidget::beforeHiding() { diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 2f03e1c6b..4a9759516 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -372,6 +372,32 @@ PeerData *MainWindow::ui_getPeerForMouseAction() { return nullptr; } +void MainWindow::enableGifPauseReason(GifPauseReason reason) { + if (!(_gifPauseReasons & reason)) { + auto notify = (static_cast(_gifPauseReasons) < static_cast(reason)); + _gifPauseReasons |= reason; + if (notify) { + _gifPauseLevelChanged.notify(); + } + } +} + +void MainWindow::disableGifPauseReason(GifPauseReason reason) { + if (_gifPauseReasons & reason) { + _gifPauseReasons &= ~qFlags(reason); + if (static_cast(_gifPauseReasons) < static_cast(reason)) { + _gifPauseLevelChanged.notify(); + } + } +} + +bool MainWindow::isGifPausedAtLeastFor(GifPauseReason reason) const { + if (reason == GifPauseReason::Any) { + return (_gifPauseReasons != 0) || !isActive(); + } + return (static_cast(_gifPauseReasons) >= 2 * static_cast(reason)) || !isActive(); +} + MainWindow::~MainWindow() = default; } // namespace Window diff --git a/Telegram/SourceFiles/window/main_window.h b/Telegram/SourceFiles/window/main_window.h index e2e77560d..cb3cf4d5c 100644 --- a/Telegram/SourceFiles/window/main_window.h +++ b/Telegram/SourceFiles/window/main_window.h @@ -26,6 +26,16 @@ class MediaView; namespace Window { +enum class GifPauseReason { + Any = 0, + InlineResults = (1 << 0), + SavedGifs = (1 << 1), + Layer = (1 << 2), + MediaPreview = (1 << 3), +}; +Q_DECLARE_FLAGS(GifPauseReasons, GifPauseReason); +Q_DECLARE_OPERATORS_FOR_FLAGS(GifPauseReasons); + class TitleWidget; class MainWindow : public QWidget, protected base::Subscriber { @@ -84,6 +94,13 @@ public: } virtual PeerData *ui_getPeerForMouseAction(); + void enableGifPauseReason(GifPauseReason reason); + void disableGifPauseReason(GifPauseReason reason); + base::Observable &gifPauseLevelChanged() { + return _gifPauseLevelChanged; + } + bool isGifPausedAtLeastFor(GifPauseReason reason) const; + public slots: bool minimizeToTray(); void updateGlobalMenu() { @@ -169,6 +186,9 @@ private: object_ptr _mediaView = { nullptr }; + GifPauseReasons _gifPauseReasons = { 0 }; + base::Observable _gifPauseLevelChanged; + }; } // namespace Window diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 0709fe000..1f2417892 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -353,7 +353,7 @@ Widget::Widget(Manager *manager, QPoint startPosition, int shift, Direction shif , _a_shift(animation(this, &Widget::step_shift)) { setWindowOpacity(0.); - setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint | Qt::NoDropShadowWindowHint); + setWindowFlags(qFlags(Qt::Tool) | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint | Qt::NoDropShadowWindowHint); setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_MacAlwaysShowToolWindow);