diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 4ad2fca84a..383e4c121c 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -365,6 +365,30 @@ S32 wchar_utf8_length(const llwchar wc) } } +std::string wchar_utf8_preview(const llwchar wc) +{ + std::ostringstream oss; + oss << std::hex << std::uppercase << (U32)wc; + + U8 out_bytes[8]; + U32 size = (U32)wchar_to_utf8chars(wc, (char*)out_bytes); + + if (size > 1) + { + oss << " ["; + for (U32 i = 0; i < size; ++i) + { + if (i) + { + oss << ", "; + } + oss << (int)out_bytes[i]; + } + oss << "]"; + } + + return oss.str(); +} S32 wstring_utf8_length(const LLWString& wstr) { diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 345fc5106b..d592a642fb 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -691,6 +691,8 @@ LL_COMMON_API S32 wstring_utf8_length(const LLWString& wstr); // Length in bytes of this wide char in a UTF8 string LL_COMMON_API S32 wchar_utf8_length(const llwchar wc); +LL_COMMON_API std::string wchar_utf8_preview(const llwchar wc); + LL_COMMON_API std::string utf8str_tolower(const std::string& utf8str); // Length in llwchar (UTF-32) of the first len units (16 bits) of the given UTF-16 string. diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index db479f38ce..207b2c3c27 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -733,6 +733,7 @@ void LLTextEditor::selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_p void LLTextEditor::insertEmoji(llwchar emoji) { + LL_INFOS() << "LLTextEditor::insertEmoji(" << wchar_utf8_preview(emoji) << ")" << LL_ENDL; auto styleParams = LLStyle::Params(); styleParams.font = LLFontGL::getFontEmoji(); auto segment = new LLEmojiTextSegment(new LLStyle(styleParams), mCursorPos, mCursorPos + 1, *this); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d79e04e159..80b37016a3 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1080,7 +1080,7 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) handled = handleUnicodeCharHere(uni_char); if (handled && LLView::sDebugKeys) { - LL_INFOS() << "Unicode key handled by " << getName() << LL_ENDL; + LL_INFOS() << "Unicode key " << wchar_utf8_preview(uni_char) << " is handled by " << getName() << LL_ENDL; } } } diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 457fe29c72..5d923db714 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -730,6 +730,19 @@ attributedStringInfo getSegments(NSAttributedString *str) - (void)insertText:(id)aString replacementRange:(NSRange)replacementRange { + // SL-19801 Special workaround for system emoji picker + if ([aString length] == 2) + { + uint32_t b0 = [aString characterAtIndex:0]; + uint32_t b1 = [aString characterAtIndex:1]; + if (((b0 & 0xF000) == 0xD000) && ((b1 & 0xF000) == 0xD000)) + { + uint32_t b = 0x10000 | ((b0 & 0x3F) << 10) | (b1 & 0x3FF); + callUnicodeCallback(b, 0); + return; + } + } + if (!mHasMarkedText) { for (NSInteger i = 0; i < [aString length]; i++) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 9b2296d9ae..2e9cdc0f35 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -275,7 +275,7 @@ BOOL LLFloaterIMSessionTab::postBuild() mEmojiRecentIconsCtrl->setVisible(false); mEmojiPickerToggleBtn = getChild("emoji_picker_toggle_btn"); - mEmojiPickerToggleBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerToggleBtnClicked(); }); + mEmojiPickerToggleBtn->setClickedCallback([](LLUICtrl*, const LLSD&) { onEmojiPickerToggleBtnClicked(); }); mGearBtn = getChild("gear_btn"); mAddBtn = getChild("add_btn"); diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 6206d9b73d..2e8f4b5d45 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -2412,7 +2412,7 @@ void LLInventoryGallery::startDrag() ids.push_back(selected_id); } - const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); + const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); if (cat && gInventory.isObjectDescendentOf(selected_id, gInventory.getRootFolderID()) && !LLFolderType::lookupIsProtectedType((cat)->getPreferredType())) { @@ -2426,7 +2426,7 @@ void LLInventoryGallery::startDrag() ids.push_back(selected_id); } } - LLToolDragAndDrop::getInstance()->beginMultiDrag(types, ids, LLToolDragAndDrop::SOURCE_AGENT); + LLToolDragAndDrop::getInstance()->beginMultiDrag(types, ids, src); } bool LLInventoryGallery::areViewsInitialized()