2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix incorrect window activation on message jump.

Fixes #28275.
This commit is contained in:
John Preston
2024-08-16 10:57:30 +02:00
parent f3dca6efb7
commit 62a20ba975
2 changed files with 19 additions and 3 deletions

View File

@@ -1295,6 +1295,9 @@ void MainWidget::showHistory(
const SectionShow &params,
MsgId showAtMsgId) {
if (peerId && _controller->window().locked()) {
if (params.activation != anim::activation::background) {
_controller->window().activate();
}
return;
} else if (auto peer = session().data().peerLoaded(peerId)) {
if (peer->migrateTo()) {
@@ -1317,6 +1320,9 @@ void MainWidget::showHistory(
&& _mainSection
&& _mainSection->showMessage(peerId, params, showAtMsgId)) {
session().data().hideShownSpoilers();
if (params.activation != anim::activation::background) {
_controller->window().activate();
}
return;
} else if (showHistoryInDifferentWindow(peerId, params, showAtMsgId)) {
return;
@@ -1502,16 +1508,26 @@ void MainWidget::showMessage(
if (!v::is_null(params.origin)) {
if (_mainSection) {
if (_mainSection->showMessage(peerId, params, itemId)) {
if (params.activation != anim::activation::background) {
_controller->window().activate();
}
return;
}
} else if (_history->peer() == item->history()->peer) {
// showHistory may be redirected to different window,
// so we don't call activate() on current controller's window.
showHistory(peerId, params, itemId);
return;
}
}
if (const auto topic = item->topic()) {
_controller->showTopic(topic, item->id, params);
if (params.activation != anim::activation::background) {
_controller->window().activate();
}
} else {
// showPeerHistory may be redirected to different window,
// so we don't call activate() on current controller's window.
_controller->showPeerHistory(
item->history(),
params,