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

Allow narrow chats width without main section.

This commit is contained in:
John Preston
2024-04-08 12:13:25 +04:00
parent 2f03b9aa29
commit 39658ffe52
7 changed files with 30 additions and 57 deletions

View File

@@ -296,11 +296,11 @@ MainWidget::MainWidget(
_player->finishAnimating();
}
rpl::merge(
_controller->dialogsListFocusedChanges(),
_controller->dialogsListDisplayForcedChanges()
_controller->chatsForceDisplayWideChanges(
) | rpl::start_with_next([=] {
updateDialogsWidthAnimated();
crl::on_main(this, [=] {
updateDialogsWidthAnimated();
});
}, lifetime());
rpl::merge(
@@ -1315,7 +1315,6 @@ void MainWidget::showHistory(
}
}
_controller->setDialogsListFocused(false);
_a_dialogsWidth.stop();
using Way = SectionShow::Way;
@@ -1708,7 +1707,6 @@ void MainWidget::showNewSection(
_controller->window().hideSettingsAndLayer();
}
_controller->setDialogsListFocused(false);
_a_dialogsWidth.stop();
auto mainSectionTop = getMainSectionTop();
@@ -2626,23 +2624,7 @@ bool MainWidget::eventFilter(QObject *o, QEvent *e) {
const auto widget = o->isWidgetType()
? static_cast<QWidget*>(o)
: nullptr;
if (e->type() == QEvent::FocusIn) {
if (widget && (widget->window() == window())) {
if (_history == widget || _history->isAncestorOf(widget)
|| (_mainSection
&& (_mainSection == widget
|| _mainSection->isAncestorOf(widget)))
|| (_thirdSection
&& (_thirdSection == widget
|| _thirdSection->isAncestorOf(widget)))) {
_controller->setDialogsListFocused(false);
} else if (_dialogs
&& (_dialogs == widget
|| _dialogs->isAncestorOf(widget))) {
_controller->setDialogsListFocused(true);
}
}
} else if (e->type() == QEvent::MouseButtonPress) {
if (e->type() == QEvent::MouseButtonPress) {
if (widget && (widget->window() == window())) {
const auto event = static_cast<QMouseEvent*>(e);
if (event->button() == Qt::BackButton) {
@@ -2749,7 +2731,7 @@ void MainWidget::updateWindowAdaptiveLayout() {
auto useSmallColumnWidth = !isOneColumn()
&& !dialogsWidthRatio
&& !_controller->forceWideDialogs();
&& !_controller->chatsForceDisplayWide();
_dialogsWidth = !_dialogs
? 0
: useSmallColumnWidth