Remember that media view was switched to PIP and open it as PIP again.

Very useful, especially on large monitors.
Since the permanent opening of the video in full screen interferes and hide other applications.
This functionality allows remembering (in the current session) that the window has been switched to a PIP mode and will open a new video directly in the PIP mode.
This commit is contained in:
Alexander Bushnev 2021-04-07 21:46:35 +02:00 committed by John Preston
parent 46ee5598f5
commit 99501d844d
2 changed files with 6 additions and 0 deletions

View File

@ -2213,6 +2213,9 @@ void OverlayWidget::showDocument(
displayDocument(document, context, cloud, continueStreaming);
preloadData(0);
activateControls();
if (_showAsPip && !videoIsGifOrUserpic()) {
switchToPip();
}
}
void OverlayWidget::displayPhoto(not_null<PhotoData*> photo, HistoryItem *item) {
@ -2982,8 +2985,10 @@ void OverlayWidget::switchToPip() {
const auto document = _document;
const auto msgId = _msgid;
const auto closeAndContinue = [=] {
_showAsPip = false;
showDocument(document, document->owner().message(msgId), {}, true);
};
_showAsPip = true;
_pip = std::make_unique<PipWrap>(
this,
document,

View File

@ -443,6 +443,7 @@ private:
std::unique_ptr<Streamed> _streamed;
std::unique_ptr<PipWrap> _pip;
bool _showAsPip = false;
const style::icon *_docIcon = nullptr;
style::color _docIconColor;