mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +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);
|
return OverlayParent::eventFilter(obj, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::setVisibleHook(bool visible) {
|
void OverlayWidget::applyHideWindowWorkaround() {
|
||||||
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();
|
|
||||||
#ifdef USE_OPENGL_OVERLAY_WIDGET
|
#ifdef USE_OPENGL_OVERLAY_WIDGET
|
||||||
// QOpenGLWidget can't properly destroy a child widget if
|
// QOpenGLWidget can't properly destroy a child widget if
|
||||||
// it is hidden exactly after that, so it must be repainted
|
// it is hidden exactly after that, so it must be repainted
|
||||||
|
@ -4333,6 +4316,27 @@ void OverlayWidget::setVisibleHook(bool visible) {
|
||||||
}
|
}
|
||||||
#endif // USE_OPENGL_OVERLAY_WIDGET
|
#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);
|
OverlayParent::setVisibleHook(visible);
|
||||||
if (visible) {
|
if (visible) {
|
||||||
QCoreApplication::instance()->installEventFilter(this);
|
QCoreApplication::instance()->installEventFilter(this);
|
||||||
|
|
|
@ -372,6 +372,8 @@ private:
|
||||||
void clearStreaming(bool savePosition = true);
|
void clearStreaming(bool savePosition = true);
|
||||||
bool canInitStreaming() const;
|
bool canInitStreaming() const;
|
||||||
|
|
||||||
|
void applyHideWindowWorkaround();
|
||||||
|
|
||||||
QBrush _transparentBrush;
|
QBrush _transparentBrush;
|
||||||
|
|
||||||
Main::Session *_session = nullptr;
|
Main::Session *_session = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue