diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2024-01-22 06:40:41 +0100 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2024-01-24 00:07:10 +0300 |
commit | f6ceafee5bb26cf86d64959cabf68deefaf791a8 (patch) | |
tree | a23ab37a1d09983e53b668f75a355fee40ac96e9 /indra/llui/lltexteditor.cpp | |
parent | ae91ae43a51c58cc496f3947921fbf886c6be86e (diff) |
SL-20416 Avoid of taking focus by EmojiPicker
Diffstat (limited to 'indra/llui/lltexteditor.cpp')
-rw-r--r-- | indra/llui/lltexteditor.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3910be1443..092739a538 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -508,7 +508,8 @@ void LLTextEditor::getSegmentsInRange(LLTextEditor::segment_vec_t& segments_out, } } -void LLTextEditor::setShowEmojiHelper(bool show) { +void LLTextEditor::setShowEmojiHelper(bool show) +{ if (!mShowEmojiHelper) { LLEmojiHelper::instance().hideHelper(this); @@ -1192,6 +1193,16 @@ void LLTextEditor::addChar(llwchar wc) } } +void LLTextEditor::showEmojiHelper() +{ + if (mReadOnly || !mShowEmojiHelper) + return; + + const LLRect cursorRect(getLocalRectFromDocIndex(mCursorPos)); + auto cb = [this](llwchar emoji) { insertEmoji(emoji); }; + LLEmojiHelper::instance().showHelper(this, cursorRect.mLeft, cursorRect.mTop, LLStringUtil::null, cb); +} + void LLTextEditor::tryToShowEmojiHelper() { if (mReadOnly || !mShowEmojiHelper) @@ -1207,6 +1218,10 @@ void LLTextEditor::tryToShowEmojiHelper() auto cb = [this](llwchar emoji) { handleEmojiCommit(emoji); }; LLEmojiHelper::instance().showHelper(this, cursorRect.mLeft, cursorRect.mTop, part, cb); } + else + { + LLEmojiHelper::instance().hideHelper(); + } } void LLTextEditor::addLineBreakChar(BOOL group_together) @@ -1911,7 +1926,12 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) // Handle most keys only if the text editor is writeable. if( !mReadOnly ) { - if( mAutoIndent && '}' == uni_char ) + if (mShowEmojiHelper && uni_char < 0x80 && LLEmojiHelper::instance().handleKey(this, (KEY)uni_char, MASK_NONE)) + { + return TRUE; + } + + if( mAutoIndent && '}' == uni_char ) { unindentLineBeforeCloseBrace(); } |