From b60e50df105db8baa4e0d578895bf5be1f6d5dda Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 22 Nov 2023 12:18:14 +0400 Subject: [PATCH] Try using hide media viewer workaround on Linux. --- .../media/view/media_view_overlay_opengl.cpp | 6 +++--- .../media/view/media_view_overlay_widget.cpp | 14 +++++--------- .../settings/settings_scale_preview.cpp | 2 +- .../window/notifications_manager_default.cpp | 2 +- Telegram/lib_ui | 2 +- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp index 96266c841967d4..6df2da00c13f83 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp @@ -298,7 +298,7 @@ void OverlayWidget::RendererGL::paint( } std::optional OverlayWidget::RendererGL::clearColor() { - if (Platform::IsWindows() && _owner->_hideWorkaround) { + if (_owner->_hideWorkaround) { return QColor(0, 0, 0, 0); } else if (_owner->_fullScreenVideo) { return st::mediaviewVideoBg->c; @@ -308,9 +308,9 @@ std::optional OverlayWidget::RendererGL::clearColor() { } bool OverlayWidget::RendererGL::handleHideWorkaround(QOpenGLFunctions &f) { - // This is needed on Windows, + // This is needed on Windows or Linux, // because on reopen it blinks with the last shown content. - return Platform::IsWindows() && _owner->_hideWorkaround; + return _owner->_hideWorkaround != nullptr; } void OverlayWidget::RendererGL::paintBackground() { diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index bc08eb778b7140..3a56a1b1198485 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -27,7 +27,6 @@ For license and copyright information please follow this link: #include "ui/image/image.h" #include "ui/layers/layer_manager.h" #include "ui/text/text_utilities.h" -#include "ui/platform/ui_platform_utility.h" #include "ui/platform/ui_platform_window_title.h" #include "ui/toast/toast.h" #include "ui/text/format_values.h" @@ -3584,11 +3583,6 @@ void OverlayWidget::displayFinished(anim::activation activation) { if (isHidden()) { _helper->beforeShow(_fullscreen); moveToScreen(); - //setAttribute(Qt::WA_DontShowOnScreen); - //OverlayParent::setVisibleHook(true); - //OverlayParent::setVisibleHook(false); - //setAttribute(Qt::WA_DontShowOnScreen, false); - //Ui::Platform::UpdateOverlayed(_window); showAndActivate(); } else if (activation == anim::activation::background) { return; @@ -6077,10 +6071,12 @@ void OverlayWidget::applyHideWindowWorkaround() { }); }, raw->lifetime()); raw->update(); + _widget->update(); - if (Platform::IsWindows()) { - Ui::Platform::UpdateOverlayed(_window); + if (!Platform::IsMac()) { + Ui::ForceFullRepaintSync(_window); } + _hideWorkaround = nullptr; } } @@ -6147,10 +6143,10 @@ void OverlayWidget::clearBeforeHide() { _helper->setControlsOpacity(1.); _groupThumbs = nullptr; _groupThumbsRect = QRect(); - _body->hide(); } void OverlayWidget::clearAfterHide() { + _body->hide(); clearStreaming(); destroyThemePreview(); _radial.stop(); diff --git a/Telegram/SourceFiles/settings/settings_scale_preview.cpp b/Telegram/SourceFiles/settings/settings_scale_preview.cpp index 7e840e31cfd8a7..efb797fee55fdd 100644 --- a/Telegram/SourceFiles/settings/settings_scale_preview.cpp +++ b/Telegram/SourceFiles/settings/settings_scale_preview.cpp @@ -192,7 +192,7 @@ void Preview::toggle(ScalePreviewShow show, int scale, int sliderX) { updateToScale(scale); updateGlobalPosition(sliderX); if (_widget.isHidden()) { - Ui::Platform::UpdateOverlayed(&_widget); + Ui::ForceFullRepaintSync(&_widget); } toggleShown(true); } diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 23bc44f64c5a90..c1d48437481bb6 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -582,7 +582,7 @@ void Widget::addToHeight(int add) { auto newHeight = height() + add; auto newPosition = computePosition(newHeight); updateGeometry(newPosition.x(), newPosition.y(), width(), newHeight); - Ui::Platform::UpdateOverlayed(this); + Ui::ForceFullRepaintSync(this); } void Widget::updateGeometry(int x, int y, int width, int height) { diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 69c8353746dbb3..cd4e9d378cc98f 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 69c8353746dbb36808b8349eff0cac0f057fa2f4 +Subproject commit cd4e9d378cc98f590f814332900ec33863ffb98c