Allow PiP from another account.

This commit is contained in:
John Preston 2020-06-25 14:28:02 +04:00
parent 8fec04ba7a
commit c60b9cfa4d
2 changed files with 19 additions and 1 deletions

View File

@ -1069,7 +1069,6 @@ void OverlayWidget::clearSession() {
_from = nullptr;
_fromName = QString();
assignMediaPointer(nullptr);
_pip = nullptr;
_fullScreenVideo = false;
_caption.clear();
_sharedMedia = nullptr;
@ -1209,6 +1208,7 @@ void OverlayWidget::onToMessage() {
}
if (const auto item = _session->data().message(_msgid)) {
close();
Core::App().domain().activate(&_session->account());
Ui::showPeerHistoryAtItem(item);
}
}
@ -1449,6 +1449,7 @@ void OverlayWidget::onDelete() {
return false;
};
Core::App().domain().activate(&_session->account());
const auto &active = _session->windows();
if (active.empty()) {
return;
@ -3845,6 +3846,11 @@ void OverlayWidget::mouseReleaseEvent(QMouseEvent *e) {
showSaveMsgFile();
return;
}
// There may be a mention / hashtag / bot command link.
// For now activate account for all activated links.
if (_session) {
Core::App().domain().activate(&_session->account());
}
ActivateClickHandler(this, activated, e->button());
return;
}
@ -3852,6 +3858,7 @@ void OverlayWidget::mouseReleaseEvent(QMouseEvent *e) {
if (_over == OverName && _down == OverName) {
if (_from) {
close();
Core::App().domain().activate(&_from->account());
Ui::showPeerProfile(_from);
}
} else if (_over == OverDate && _down == OverDate) {

View File

@ -17,6 +17,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_file_origin.h"
#include "data/data_session.h"
#include "data/data_media_rotation.h"
#include "main/main_account.h"
#include "main/main_session.h"
#include "core/application.h"
#include "base/platform/base_platform_info.h"
#include "ui/platform/ui_platform_utility.h"
@ -875,6 +877,15 @@ Pip::Pip(
setupPanel();
setupButtons();
setupStreaming();
_data->session().account().sessionChanges(
) | rpl::start_with_next_done([=](Main::Session *session) {
if (!session) {
_destroy();
}
}, [=] {
_destroy();
}, _panel.lifetime());
}
Pip::~Pip() = default;