Skip to content

Commit

Permalink
Try using hide media viewer workaround on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Nov 22, 2023
1 parent 4696f73 commit b60e50d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void OverlayWidget::RendererGL::paint(
}

std::optional<QColor> 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;
Expand All @@ -308,9 +308,9 @@ std::optional<QColor> 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() {
Expand Down
14 changes: 5 additions & 9 deletions Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/settings/settings_scale_preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b60e50d

Please sign in to comment.