mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Improve media viewer hiding workaround on macOS.
This commit is contained in:
parent
51f960442e
commit
e29ee439cf
2 changed files with 25 additions and 19 deletions
|
@ -4295,24 +4295,7 @@ bool OverlayWidget::eventFilter(QObject *obj, QEvent *e) {
|
|||
return OverlayParent::eventFilter(obj, e);
|
||||
}
|
||||
|
||||
void OverlayWidget::setVisibleHook(bool visible) {
|
||||
if (!visible) {
|
||||
_sharedMedia = nullptr;
|
||||
_sharedMediaData = std::nullopt;
|
||||
_sharedMediaDataKey = std::nullopt;
|
||||
_userPhotos = nullptr;
|
||||
_userPhotosData = std::nullopt;
|
||||
_collage = nullptr;
|
||||
_collageData = std::nullopt;
|
||||
assignMediaPointer(nullptr);
|
||||
_preloadPhotos.clear();
|
||||
_preloadDocuments.clear();
|
||||
if (_menu) _menu->hideMenu(true);
|
||||
_controlsHideTimer.stop();
|
||||
_controlsState = ControlsShown;
|
||||
_controlsOpacity = anim::value(1, 1);
|
||||
_groupThumbs = nullptr;
|
||||
_groupThumbsRect = QRect();
|
||||
void OverlayWidget::applyHideWindowWorkaround() {
|
||||
#ifdef USE_OPENGL_OVERLAY_WIDGET
|
||||
// QOpenGLWidget can't properly destroy a child widget if
|
||||
// it is hidden exactly after that, so it must be repainted
|
||||
|
@ -4332,6 +4315,27 @@ void OverlayWidget::setVisibleHook(bool visible) {
|
|||
}
|
||||
}
|
||||
#endif // USE_OPENGL_OVERLAY_WIDGET
|
||||
}
|
||||
|
||||
void OverlayWidget::setVisibleHook(bool visible) {
|
||||
if (!visible) {
|
||||
applyHideWindowWorkaround();
|
||||
_sharedMedia = nullptr;
|
||||
_sharedMediaData = std::nullopt;
|
||||
_sharedMediaDataKey = std::nullopt;
|
||||
_userPhotos = nullptr;
|
||||
_userPhotosData = std::nullopt;
|
||||
_collage = nullptr;
|
||||
_collageData = std::nullopt;
|
||||
assignMediaPointer(nullptr);
|
||||
_preloadPhotos.clear();
|
||||
_preloadDocuments.clear();
|
||||
if (_menu) _menu->hideMenu(true);
|
||||
_controlsHideTimer.stop();
|
||||
_controlsState = ControlsShown;
|
||||
_controlsOpacity = anim::value(1, 1);
|
||||
_groupThumbs = nullptr;
|
||||
_groupThumbsRect = QRect();
|
||||
}
|
||||
OverlayParent::setVisibleHook(visible);
|
||||
if (visible) {
|
||||
|
|
|
@ -372,6 +372,8 @@ private:
|
|||
void clearStreaming(bool savePosition = true);
|
||||
bool canInitStreaming() const;
|
||||
|
||||
void applyHideWindowWorkaround();
|
||||
|
||||
QBrush _transparentBrush;
|
||||
|
||||
Main::Session *_session = nullptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue