From 7c8b1cd5b1d32bbfb073f89d761b63260eab4e70 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 26 Jul 2021 18:54:58 +0300 Subject: [PATCH] Disabled forced session switching when closing PiP. Regression was introduced in 7decf68122. --- .../SourceFiles/media/view/media_view_overlay_widget.cpp | 6 +++--- Telegram/SourceFiles/media/view/media_view_overlay_widget.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index a7d12f039..cea9d6870 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -3103,7 +3103,7 @@ void OverlayWidget::switchToPip() { const auto closeAndContinue = [=] { _showAsPip = false; show(OpenRequest( - findWindow(), + findWindow(false), document, document->owner().message(msgId), true)); @@ -4536,7 +4536,7 @@ void OverlayWidget::applyHideWindowWorkaround() { } } -Window::SessionController *OverlayWidget::findWindow() const { +Window::SessionController *OverlayWidget::findWindow(bool switchTo) const { if (!_session) { return nullptr; } @@ -4553,7 +4553,7 @@ Window::SessionController *OverlayWidget::findWindow() const { const auto &active = _session->windows(); if (!active.empty()) { return active.front(); - } else if (window) { + } else if (window && switchTo) { Window::SessionController *controllerPtr = nullptr; window->invokeForSessionController( &_session->account(), diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.h b/Telegram/SourceFiles/media/view/media_view_overlay_widget.h index 3d567edf5..24a1cb273 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.h +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.h @@ -411,7 +411,7 @@ private: void applyHideWindowWorkaround(); - Window::SessionController *findWindow() const; + Window::SessionController *findWindow(bool switchTo = true) const; bool _opengl = false; const std::unique_ptr _surface;