mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-01 23:15:59 +00:00
Redirect IME to search on Windows.
This commit is contained in:
@@ -356,6 +356,14 @@ Widget::Widget(
|
||||
Ui::PostponeCall(this, [=] { listScrollUpdated(); });
|
||||
}, lifetime());
|
||||
|
||||
setAttribute(Qt::WA_InputMethodEnabled);
|
||||
controller->widget()->imeCompositionStarts(
|
||||
) | rpl::filter([=] {
|
||||
return redirectImeToSearch();
|
||||
}) | rpl::start_with_next([=] {
|
||||
_search->setFocusFast();
|
||||
}, lifetime());
|
||||
|
||||
_search->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
applySearchUpdate();
|
||||
@@ -3290,12 +3298,17 @@ void Widget::keyPressEvent(QKeyEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Widget::redirectToSearchPossible() const {
|
||||
return !_openedFolder
|
||||
&& !_openedForum
|
||||
&& !_childList
|
||||
&& _search->isVisible()
|
||||
&& !_search->hasFocus()
|
||||
&& hasFocus();
|
||||
}
|
||||
|
||||
bool Widget::redirectKeyToSearch(QKeyEvent *e) const {
|
||||
if (_openedFolder
|
||||
|| _openedForum
|
||||
|| _childList
|
||||
|| !_search->isVisible()
|
||||
|| _search->hasFocus()) {
|
||||
if (!redirectToSearchPossible()) {
|
||||
return false;
|
||||
}
|
||||
const auto character = !(e->modifiers() & ~Qt::ShiftModifier)
|
||||
@@ -3316,6 +3329,10 @@ bool Widget::redirectKeyToSearch(QKeyEvent *e) const {
|
||||
return data && data->hasText();
|
||||
}
|
||||
|
||||
bool Widget::redirectImeToSearch() const {
|
||||
return redirectToSearchPossible();
|
||||
}
|
||||
|
||||
void Widget::paintEvent(QPaintEvent *e) {
|
||||
if (controller()->contentOverlapped(this, e)) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user