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

Fix unintentional search focus.

This commit is contained in:
John Preston
2024-05-29 12:08:22 +04:00
parent a9a0fe7cf5
commit e2b78b673b
3 changed files with 17 additions and 4 deletions

View File

@@ -1772,7 +1772,7 @@ void MainWidget::showNewSection(
_thirdSection = std::move(newThirdSection);
_thirdSection->removeRequests(
) | rpl::start_with_next([=] {
_thirdSection.destroy();
destroyThirdSection();
_thirdShadow.destroy();
updateControlsGeometry();
}, _thirdSection->lifetime());
@@ -2289,7 +2289,7 @@ void MainWidget::updateControlsGeometry() {
}
}
} else {
_thirdSection.destroy();
destroyThirdSection();
_thirdShadow.destroy();
}
const auto mainSectionTop = getMainSectionTop();
@@ -2408,6 +2408,15 @@ void MainWidget::updateControlsGeometry() {
floatPlayerUpdatePositions();
}
void MainWidget::destroyThirdSection() {
if (const auto strong = _thirdSection.data()) {
if (Ui::InFocusChain(strong)) {
setFocus();
}
}
_thirdSection.destroy();
}
void MainWidget::refreshResizeAreas() {
if (!isOneColumn() && _dialogs) {
ensureFirstColumnResizeAreaCreated();
@@ -2555,7 +2564,7 @@ void MainWidget::updateThirdColumnToCurrentChat(
if (saveThirdSectionToStackBack()) {
_stack.back()->setThirdSectionMemento(
_thirdSection->createMemento());
_thirdSection.destroy();
destroyThirdSection();
}
};
auto &settings = Core::App().settings();
@@ -2601,7 +2610,7 @@ void MainWidget::updateThirdColumnToCurrentChat(
settings.setTabbedReplacedWithInfo(false);
if (!key) {
if (_thirdSection) {
_thirdSection.destroy();
destroyThirdSection();
_thirdShadow.destroy();
updateControlsGeometry();
}