mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Fix accidental search focusing.
This commit is contained in:
parent
c6d034174b
commit
10c427127e
4 changed files with 18 additions and 11 deletions
|
@ -958,6 +958,9 @@ void TabbedSelector::beforeHiding() {
|
|||
_beforeHidingCallback(_currentTabType);
|
||||
}
|
||||
}
|
||||
if (Ui::InFocusChain(this)) {
|
||||
window()->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void TabbedSelector::afterShown() {
|
||||
|
|
|
@ -58,7 +58,16 @@ void PickUntilBox(not_null<Ui::GenericBox*> box, Fn<void(TimeId)> callback) {
|
|||
|
||||
EmojiStatusPanel::EmojiStatusPanel() = default;
|
||||
|
||||
EmojiStatusPanel::~EmojiStatusPanel() = default;
|
||||
EmojiStatusPanel::~EmojiStatusPanel() {
|
||||
if (hasFocus()) {
|
||||
// Panel will try to return focus to the layer widget, the problem is
|
||||
// we are destroying the layer widget probably right now and focusing
|
||||
// it will lead to a crash, because it destroys its children (how we
|
||||
// got here) after it clears focus out of itself. So if you return
|
||||
// the focus inside a child destructor, it won't be cleared at all.
|
||||
_panel->window()->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void EmojiStatusPanel::setChooseFilter(Fn<bool(DocumentId)> filter) {
|
||||
_chooseFilter = std::move(filter);
|
||||
|
|
|
@ -2644,6 +2644,10 @@ bool MainWidget::eventFilter(QObject *o, QEvent *e) {
|
|||
if (e->type() == QEvent::FocusIn) {
|
||||
if (widget && relevantForDialogsFocus(widget)) {
|
||||
_dialogs->updateHasFocus(widget);
|
||||
} else if (widget == window()) {
|
||||
crl::on_main(this, [=] {
|
||||
_controller->widget()->setInnerFocus();
|
||||
});
|
||||
}
|
||||
} else if (e->type() == QEvent::MouseButtonPress) {
|
||||
if (widget && (widget->window() == window())) {
|
||||
|
|
|
@ -165,16 +165,7 @@ Cover::Cover(
|
|||
}, _name->lifetime());
|
||||
}
|
||||
|
||||
Cover::~Cover() {
|
||||
if (_emojiStatusPanel.hasFocus()) {
|
||||
// Panel will try to return focus to the layer widget, the problem is
|
||||
// we are destroying the layer widget probably right now and focusing
|
||||
// it will lead to a crash, because it destroys its children (how we
|
||||
// got here) after it clears focus out of itself. So if you return
|
||||
// the focus inside a child destructor, it won't be cleared at all.
|
||||
window()->setFocus();
|
||||
}
|
||||
}
|
||||
Cover::~Cover() = default;
|
||||
|
||||
void Cover::setupChildGeometry() {
|
||||
using namespace rpl::mappers;
|
||||
|
|
Loading…
Add table
Reference in a new issue