Delay UpdatePowerSaveBlocker to show in media viewer

This commit is contained in:
Ilya Fedin 2024-06-21 16:59:10 +04:00 committed by John Preston
parent 006d6fe2c0
commit eea50ed6b0

View file

@ -631,7 +631,6 @@ OverlayWidget::OverlayWidget()
_window->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); _window->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
} }
_widget->setMouseTracking(true); _widget->setMouseTracking(true);
_window->createWinId();
_window->screenValue( _window->screenValue(
) | rpl::skip(1) | rpl::start_with_next([=](not_null<QScreen*> screen) { ) | rpl::skip(1) | rpl::start_with_next([=](not_null<QScreen*> screen) {
@ -3823,12 +3822,17 @@ void OverlayWidget::updatePowerSaveBlocker(
&& _document->isVideoFile() && _document->isVideoFile()
&& !IsPausedOrPausing(state.state) && !IsPausedOrPausing(state.state)
&& !IsStoppedOrStopping(state.state); && !IsStoppedOrStopping(state.state);
base::UpdatePowerSaveBlocker(
_streamed->powerSaveBlocker, _window->shownValue() | rpl::filter([=](bool shown) {
block, return shown;
base::PowerSaveBlockType::PreventDisplaySleep, }) | rpl::take(1) | rpl::start_with_next([=] {
[] { return u"Video playback is active"_q; }, base::UpdatePowerSaveBlocker(
[=] { return window(); }); _streamed->powerSaveBlocker,
block,
base::PowerSaveBlockType::PreventDisplaySleep,
[] { return u"Video playback is active"_q; },
[=] { return window(); });
}, lifetime());
} }
QImage OverlayWidget::transformedShownContent() const { QImage OverlayWidget::transformedShownContent() const {