mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Don't collapse chats list on window unfocus.
This commit is contained in:
parent
39658ffe52
commit
11e4c45969
3 changed files with 22 additions and 8 deletions
|
@ -358,8 +358,11 @@ Widget::Widget(
|
|||
applySearchUpdate();
|
||||
}, _search->lifetime());
|
||||
|
||||
_search->focusedChanges() | rpl::start_with_next([=](bool focused) {
|
||||
updateForceDisplayWide();
|
||||
_search->focusedChanges(
|
||||
) | rpl::start_with_next([=](bool focused) {
|
||||
if (focused) {
|
||||
updateHasFocus(_search.data());
|
||||
}
|
||||
}, _search->lifetime());
|
||||
|
||||
_search->submits(
|
||||
|
@ -1020,7 +1023,7 @@ void Widget::updateControlsVisibility(bool fast) {
|
|||
updateLoadMoreChatsVisibility();
|
||||
_scroll->show();
|
||||
updateStoriesVisibility();
|
||||
if ((_openedFolder || _openedForum) && _search->hasFocus()) {
|
||||
if ((_openedFolder || _openedForum) && _searchHasFocus.current()) {
|
||||
setInnerFocus();
|
||||
}
|
||||
if (_updateTelegram) {
|
||||
|
@ -1059,7 +1062,7 @@ void Widget::updateControlsVisibility(bool fast) {
|
|||
if (_hideChildListCanvas) {
|
||||
_hideChildListCanvas->show();
|
||||
}
|
||||
if (_childList && _search->hasFocus()) {
|
||||
if (_childList && _searchHasFocus.current()) {
|
||||
setInnerFocus();
|
||||
}
|
||||
updateLockUnlockPosition();
|
||||
|
@ -1081,6 +1084,11 @@ void Widget::updateLockUnlockPosition() {
|
|||
st::dialogsFilterPadding.y());
|
||||
}
|
||||
|
||||
void Widget::updateHasFocus(not_null<QWidget*> focused) {
|
||||
_searchHasFocus = (focused == _search.data());
|
||||
updateForceDisplayWide();
|
||||
}
|
||||
|
||||
void Widget::changeOpenedSubsection(
|
||||
FnMut<void()> change,
|
||||
bool fromRight,
|
||||
|
@ -1637,7 +1645,7 @@ void Widget::slideFinished() {
|
|||
_shownProgressValue = 1.;
|
||||
updateControlsVisibility(true);
|
||||
if ((!_subsectionTopBar || !_subsectionTopBar->searchHasFocus())
|
||||
&& !_search->hasFocus()) {
|
||||
&& !_searchHasFocus.current()) {
|
||||
controller()->widget()->setInnerFocus();
|
||||
}
|
||||
}
|
||||
|
@ -2479,7 +2487,7 @@ void Widget::applySearchUpdate(bool force) {
|
|||
}
|
||||
|
||||
void Widget::updateForceDisplayWide() {
|
||||
controller()->setChatsForceDisplayWide(_search->hasFocus()
|
||||
controller()->setChatsForceDisplayWide(_searchHasFocus.current()
|
||||
|| !_search->getLastText().isEmpty()
|
||||
|| _searchInChat);
|
||||
}
|
||||
|
@ -3203,7 +3211,7 @@ bool Widget::cancelSearch() {
|
|||
_inner->clearFilter();
|
||||
clearSearchField();
|
||||
applySearchUpdate();
|
||||
if (!_searchInChat && _search->hasFocus()) {
|
||||
if (!_searchInChat && _searchHasFocus.current()) {
|
||||
setFocus();
|
||||
}
|
||||
return clearingQuery || clearingInChat;
|
||||
|
|
|
@ -123,6 +123,7 @@ public:
|
|||
|
||||
[[nodiscard]] RowDescriptor resolveChatNext(RowDescriptor from = {}) const;
|
||||
[[nodiscard]] RowDescriptor resolveChatPrevious(RowDescriptor from = {}) const;
|
||||
void updateHasFocus(not_null<QWidget*> focused);
|
||||
|
||||
// Float player interface.
|
||||
bool floatPlayerHandleWheelEvent(QEvent *e) override;
|
||||
|
@ -296,6 +297,7 @@ private:
|
|||
std::vector<Data::ReactionId> _searchTags;
|
||||
rpl::lifetime _searchTagsLifetime;
|
||||
QString _lastSearchText;
|
||||
rpl::variable<bool> _searchHasFocus = false;
|
||||
|
||||
rpl::event_stream<rpl::producer<Stories::Content>> _storiesContents;
|
||||
base::flat_map<PeerId, Ui::PeerUserpicView> _storiesUserpicsViewsHidden;
|
||||
|
|
|
@ -2624,7 +2624,11 @@ bool MainWidget::eventFilter(QObject *o, QEvent *e) {
|
|||
const auto widget = o->isWidgetType()
|
||||
? static_cast<QWidget*>(o)
|
||||
: nullptr;
|
||||
if (e->type() == QEvent::MouseButtonPress) {
|
||||
if (e->type() == QEvent::FocusIn) {
|
||||
if (widget && _dialogs && widget->window() == window()) {
|
||||
_dialogs->updateHasFocus(widget);
|
||||
}
|
||||
} else if (e->type() == QEvent::MouseButtonPress) {
|
||||
if (widget && (widget->window() == window())) {
|
||||
const auto event = static_cast<QMouseEvent*>(e);
|
||||
if (event->button() == Qt::BackButton) {
|
||||
|
|
Loading…
Add table
Reference in a new issue