Skip to content

Commit 587538d

Browse files
meh7anjohn-preston
authored andcommitted
Add a menu button and fix search flashes in the collapsed archive
1 parent 52539f4 commit 587538d

2 files changed

Lines changed: 29 additions & 5 deletions

File tree

‎Telegram/SourceFiles/dialogs/dialogs_widget.cpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2847,6 +2847,7 @@ void Widget::updateStoriesVisibility() {
28472847
}
28482848
const auto widthAnimation = !_widthAnimationCache.isNull();
28492849
const auto suggestionsAnimation = widthAnimation
2850+
&& !_openedFolder
28502851
&& (!_suggestions || !_hidingSuggestions.empty());
28512852
const auto hiddenAnimated = _searchHasFocus
28522853
|| _searchSuggestionsLocked
@@ -2898,9 +2899,9 @@ void Widget::updateStoriesTitleShown() {
28982899
if (!_subsectionTopBar || !_openedFolder) {
28992900
return;
29002901
}
2901-
const auto shown = (!_stories
2902-
|| _stories->empty()
2903-
|| _stories->toggledHidden())
2902+
const auto shown = !_widthAnimationCache.isNull()
2903+
? 0.
2904+
: (!_stories || _stories->empty() || _stories->toggledHidden())
29042905
? 1.
29052906
: _stories->collapsedGeometryCurrent().expanded;
29062907
_subsectionTopBar->setTitleShownRatio(shown);

‎Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,16 @@ void TopBarWidget::showPeerMenu() {
403403
Window::FillDialogsEntryMenu(_controller, _activeChat, addAction);
404404
if (_menu->empty()) {
405405
closeMenu();
406+
} else if (_narrowRatio > 0.) {
407+
_menu->setForcedOrigin(Ui::PanelAnimation::Origin::TopLeft);
408+
_menu->popup(Ui::PopupMenu::ConstrainToParentScreen(
409+
_menu,
410+
mapToGlobal(
411+
QPoint(
412+
-st::topBarMenuPosition.x()
413+
- Ui::BoxShadow::ExtendFor(
414+
_menu->st().shadow).left(),
415+
st::topBarMenuPosition.y()))));
406416
} else {
407417
_menu->setForcedOrigin(Ui::PanelAnimation::Origin::TopRight);
408418
_menu->popup(Ui::PopupMenu::ConstrainToParentScreen(
@@ -1260,7 +1270,19 @@ void TopBarWidget::updateControlsGeometry() {
12601270
}
12611271

12621272
_rightTaken = 0;
1263-
_menuToggle->moveToRight(_rightTaken, otherButtonsTop);
1273+
if (rootChatsListBar() && _activeChat.key.folder()) {
1274+
const auto &toggle = st::topBarMenuToggle;
1275+
const auto narrowLeft = (_narrowWidth - toggle.icon.width()) / 2
1276+
- toggle.iconPosition.x();
1277+
_menuToggle->moveToLeft(
1278+
anim::interpolate(
1279+
width() - _menuToggle->width(),
1280+
narrowLeft,
1281+
_narrowRatio),
1282+
otherButtonsTop);
1283+
} else {
1284+
_menuToggle->moveToRight(_rightTaken, otherButtonsTop);
1285+
}
12641286
if (_menuToggle->isHidden()) {
12651287
_rightTaken += (_menuToggle->width() - _search->width());
12661288
} else {
@@ -1384,7 +1406,8 @@ void TopBarWidget::updateControlsVisibility() {
13841406
}
13851407
_menuToggle->setVisible(hasMenu
13861408
&& !_chooseForReportReason
1387-
&& (_narrowRatio < 1.));
1409+
&& (_narrowRatio < 1.
1410+
|| (rootChatsListBar() && _activeChat.key.folder())));
13881411
_infoToggle->setVisible(hasInfo
13891412
&& !isOneColumn
13901413
&& _controller->canShowThirdSection()

0 commit comments

Comments
 (0)