From 705230a26ed4c33af2d3af07c160386ded740079 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 22 Oct 2024 13:21:50 +0800 Subject: Revert "IME composition is now replaced by the result" This reverts commit 60592ae0d7a98e071e516fcac70c5bf1427f20be. --- indra/llui/llfocusmgr.cpp | 2 +- indra/llui/llfocusmgr.h | 2 +- indra/llui/lllineeditor.cpp | 12 ++++-------- indra/llui/lllineeditor.h | 4 ++-- indra/llui/lltexteditor.cpp | 10 +++------- indra/llui/lltexteditor.h | 4 ++-- indra/llui/llview.cpp | 8 ++++---- indra/llui/llview.h | 4 ++-- 8 files changed, 19 insertions(+), 27 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 4f3d2328aa..9773a0a526 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -59,7 +59,7 @@ bool LLFocusableElement::handleUnicodeChar(llwchar uni_char, bool called_from_pa } // virtual -bool LLFocusableElement::handleUnicodeString(char *uni_str, bool editing, bool called_from_parent) +bool LLFocusableElement::handleUnicodeString(char *uni_str, bool called_from_parent) { return FALSE; } diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 1ca6f50354..9cd442e8fc 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -59,7 +59,7 @@ public: virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); virtual bool handleKeyUp(KEY key, MASK mask, bool called_from_parent); virtual bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); - virtual bool handleUnicodeString(char *uni_str, bool editing, bool called_from_parent); + virtual bool handleUnicodeString(char *uni_str, bool called_from_parent); /** * If true this LLFocusableElement wants to receive KEYUP and KEYDOWN messages diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index ac7948f735..87b0c74916 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1031,7 +1031,7 @@ void LLLineEditor::addChar(const llwchar uni_char) getWindow()->hideCursorUntilMouseMove(); } -void LLLineEditor::addString(char *s, bool editing) +void LLLineEditor::addString(char *s) { if (hasSelection()) deleteSelection(); @@ -1040,13 +1040,9 @@ void LLLineEditor::addString(char *s, bool editing) .substr(getCursor(), 1))) return; mText.erase(getCursor(), 1); - } else if (editing) { - mText.clear(); - setCursor(0); } mText.insert(getCursor(), utf8str_to_wstring(s)); - if (editing) setCursor(strlen(s)); - else setCursor(getCursor() + 1); + setCursor(getCursor() + 1); getWindow()->hideCursorUntilMouseMove(); } @@ -1704,7 +1700,7 @@ bool LLLineEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -bool LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) +bool LLLineEditor::handleUnicodeStringHere(char *uni_str) { auto handled = FALSE; @@ -1713,7 +1709,7 @@ bool LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) handled = TRUE; LLLineEditorRollback rollback(this); - addString(uni_str, editing); + addString(uni_str); mKeystrokeTimer.reset(); deselect(); diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 3a39a7363d..5291f31d09 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -133,7 +133,7 @@ public: /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; /*virtual*/ bool handleKeyHere(KEY key, MASK mask) override; /*virtual*/ bool handleUnicodeCharHere(llwchar uni_char) override; - /*virtual*/ bool handleUnicodeStringHere(char *uni_str, bool editing) override; + /*virtual*/ bool handleUnicodeStringHere(char *uni_str) override; /*virtual*/ void onMouseCaptureLost() override; // LLEditMenuHandler overrides @@ -301,7 +301,7 @@ public: void removeChar(); void addChar(const llwchar c); - void addString(char *s, bool editing); + void addString(char *s); void setCursorAtLocalPos(S32 local_mouse_x); S32 findPixelNearestPos(S32 cursor_offset = 0) const; S32 calcCursorPos(S32 mouse_x); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index cbbb164cb2..6620b684f4 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1257,7 +1257,7 @@ void LLTextEditor::addChar(llwchar wc) } } -void LLTextEditor::addString(char *str, bool editing) +void LLTextEditor::addString(char *str) { if (!getEnabled()) return; @@ -1265,10 +1265,6 @@ void LLTextEditor::addString(char *str, bool editing) deleteSelection(TRUE); else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) removeChar(mCursorPos); - else if (editing) { - clear(); - setCursorPos(0); - } setCursorPos(mCursorPos + addString(mCursorPos, str)); @@ -2060,12 +2056,12 @@ bool LLTextEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -bool LLTextEditor::handleUnicodeStringHere(char *uni_str, bool editing) +bool LLTextEditor::handleUnicodeStringHere(char *uni_str) { auto handled = FALSE; if (!mReadOnly) { - addString(uni_str, editing); + addString(uni_str); getWindow()->hideCursorUntilMouseMove(); handled = TRUE; } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 47dcadf090..24da5c04e5 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -105,7 +105,7 @@ public: virtual bool handleKeyHere(KEY key, MASK mask ); virtual bool handleUnicodeCharHere(llwchar uni_char); - virtual bool handleUnicodeStringHere(char *uni_str, bool editing); + virtual bool handleUnicodeStringHere(char *uni_str); virtual void onMouseCaptureLost(); @@ -250,7 +250,7 @@ protected: // Undoable operations void addChar(llwchar c); // at mCursorPos S32 addChar(S32 pos, llwchar wc); - void addString(char *s, bool editing); + void addString(char *s); S32 addString(S32 pos, char *str); void addLineBreakChar(bool group_together = false); S32 overwriteChar(S32 pos, llwchar wc); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index f2a1e16aad..cead5b5956 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1080,18 +1080,18 @@ bool LLView::handleUnicodeChar(llwchar uni_char, bool called_from_parent) return handled; } -bool LLView::handleUnicodeString(char *uni_str, bool editing, bool called_from_parent) +bool LLView::handleUnicodeString(char *uni_str, bool called_from_parent) { auto handled = FALSE; if (getVisible() && getEnabled() && !handled) { - handled = handleUnicodeStringHere(uni_str, editing); + handled = handleUnicodeStringHere(uni_str); if (handled && LLView::sDebugKeys) LL_INFOS() << "Unicode key handled by " << getName() << LL_ENDL; } if (!handled && !called_from_parent && mParentView) - handled = mParentView->handleUnicodeString(uni_str, editing, FALSE); + handled = mParentView->handleUnicodeString(uni_str, FALSE); return handled; } @@ -1101,7 +1101,7 @@ bool LLView::handleUnicodeCharHere(llwchar uni_char ) return false; } -bool LLView::handleUnicodeStringHere(char *uni_str, bool editing) +bool LLView::handleUnicodeStringHere(char *uni_str) { return FALSE; } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 876bfafaa3..7f57a8d7db 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -385,7 +385,7 @@ public: /* virtual */ bool handleKey(KEY key, MASK mask, bool called_from_parent); /* virtual */ bool handleKeyUp(KEY key, MASK mask, bool called_from_parent); /* virtual */ bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); - /* virtual */ bool handleUnicodeString(char *uni_str, bool editing, bool called_from_parent); + /* virtual */ bool handleUnicodeString(char *uni_str, bool called_from_parent); virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, @@ -519,7 +519,7 @@ public: virtual bool handleKeyHere(KEY key, MASK mask); virtual bool handleKeyUpHere(KEY key, MASK mask); virtual bool handleUnicodeCharHere(llwchar uni_char); - virtual bool handleUnicodeStringHere(char *uni_str, bool editing); + virtual bool handleUnicodeStringHere(char *uni_str); virtual void handleReshape(const LLRect& rect, bool by_user); virtual void dirtyRect(); -- cgit v1.2.3 From 35ee215d68c891bcbf3fd64709f000c0a8e7f597 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 22 Oct 2024 13:42:22 +0800 Subject: Revert "First attempt to fix unicode input" This reverts commit aaa8cb5a37a720ff67792d0a31fec793b03b3742. --- indra/llui/llfocusmgr.cpp | 6 --- indra/llui/llfocusmgr.h | 1 - indra/llui/lllineeditor.cpp | 45 ------------------- indra/llui/lllineeditor.h | 2 - indra/llui/lltexteditor.cpp | 102 -------------------------------------------- indra/llui/lltexteditor.h | 4 -- indra/llui/llview.cpp | 19 --------- indra/llui/llview.h | 2 - 8 files changed, 181 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 9773a0a526..0d7c98294f 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -58,12 +58,6 @@ bool LLFocusableElement::handleUnicodeChar(llwchar uni_char, bool called_from_pa return false; } -// virtual -bool LLFocusableElement::handleUnicodeString(char *uni_str, bool called_from_parent) -{ - return FALSE; -} - // virtual bool LLFocusableElement::wantsKeyUpKeyDown() const { diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 9cd442e8fc..1fa0ac137e 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -59,7 +59,6 @@ public: virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); virtual bool handleKeyUp(KEY key, MASK mask, bool called_from_parent); virtual bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); - virtual bool handleUnicodeString(char *uni_str, bool called_from_parent); /** * If true this LLFocusableElement wants to receive KEYUP and KEYDOWN messages diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 87b0c74916..60b6115b34 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1031,21 +1031,6 @@ void LLLineEditor::addChar(const llwchar uni_char) getWindow()->hideCursorUntilMouseMove(); } -void LLLineEditor::addString(char *s) -{ - if (hasSelection()) - deleteSelection(); - else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { - if (!prevalidateInput(mText.getWString() - .substr(getCursor(), 1))) - return; - mText.erase(getCursor(), 1); - } - mText.insert(getCursor(), utf8str_to_wstring(s)); - setCursor(getCursor() + 1); - getWindow()->hideCursorUntilMouseMove(); -} - // Extends the selection box to the new cursor position void LLLineEditor::extendSelection( S32 new_cursor_pos ) { @@ -1700,36 +1685,6 @@ bool LLLineEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -bool LLLineEditor::handleUnicodeStringHere(char *uni_str) -{ - auto handled = FALSE; - - if ((gFocusMgr.getKeyboardFocus() == this) - && getVisible() && !mReadOnly) { - handled = TRUE; - LLLineEditorRollback rollback(this); - - addString(uni_str); - - mKeystrokeTimer.reset(); - deselect(); - auto need_to_rollback = mPrevalidator - && !mPrevalidator.validate(mText.getWString()); - - if (need_to_rollback) { - rollback.doRollback(this); - LLUI::getInstance()->reportBadKeystroke(); - mPrevalidator.showLastErrorUsingTimeout(); - } - - if (!need_to_rollback && handled) { - onKeystroke(); - mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY); - } - } - - return handled; -} bool LLLineEditor::canDoDelete() const { diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 5291f31d09..cdd22413e7 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -133,7 +133,6 @@ public: /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; /*virtual*/ bool handleKeyHere(KEY key, MASK mask) override; /*virtual*/ bool handleUnicodeCharHere(llwchar uni_char) override; - /*virtual*/ bool handleUnicodeStringHere(char *uni_str) override; /*virtual*/ void onMouseCaptureLost() override; // LLEditMenuHandler overrides @@ -301,7 +300,6 @@ public: void removeChar(); void addChar(const llwchar c); - void addString(char *s); void setCursorAtLocalPos(S32 local_mouse_x); S32 findPixelNearestPos(S32 cursor_offset = 0) const; S32 calcCursorPos(S32 mouse_x); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 6620b684f4..3537c764b9 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -166,50 +166,6 @@ private: }; -/////////////////////////////////////////////////////////////////// -class LLTextEditor::TextCmdAddString : public LLTextBase::TextCmd -{ -public: - TextCmdAddString(S32 pos, bool group_with_next, char *str, - LLTextSegmentPtr segment) : - TextCmd(pos, group_with_next, segment), - mWString(utf8str_to_wstring(str)), - mBlockExtensions(FALSE) - { - } - virtual void blockExtensions() - { - mBlockExtensions = TRUE; - } - virtual bool canExtend(S32 pos) const - { - if (!mSegments.empty()) return FALSE; - - return !mBlockExtensions - && (pos == getPosition() + (S32)mWString.length()); - } - virtual bool execute(LLTextBase* editor, S32* delta) - { - *delta = insert(editor, getPosition(), mWString); - LLWStringUtil::truncate(mWString, *delta); - return (*delta != 0); - } - virtual S32 undo(LLTextBase* editor) - { - remove(editor, getPosition(), mWString.length()); - return getPosition(); - } - virtual S32 redo(LLTextBase* editor) - { - insert(editor, getPosition(), mWString); - return getPosition() + mWString.length(); - } - -private: - LLWString mWString; - bool mBlockExtensions; -}; - /////////////////////////////////////////////////////////////////// class LLTextEditor::TextCmdOverwriteChar : public LLTextBase::TextCmd @@ -1208,18 +1164,6 @@ S32 LLTextEditor::addChar(S32 pos, llwchar wc) return execute(new TextCmdAddChar(pos, false, wc, LLTextSegmentPtr())); } -S32 LLTextEditor::addString(S32 pos, char *str) -{ - if ((wstring_utf8_length(getWText()) + strlen(str)) - > mMaxTextByteLength) { - make_ui_sound("UISndBadKeystroke"); - return 0; - } - - return execute(new TextCmdAddString(pos, FALSE, str, - LLTextSegmentPtr())); -} - void LLTextEditor::addChar(llwchar wc) { if (!getEnabled()) @@ -1257,34 +1201,6 @@ void LLTextEditor::addChar(llwchar wc) } } -void LLTextEditor::addString(char *str) -{ - if (!getEnabled()) - return; - if (hasSelection()) - deleteSelection(TRUE); - else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) - removeChar(mCursorPos); - - setCursorPos(mCursorPos + addString(mCursorPos, str)); - - if (!mReadOnly && mAutoreplaceCallback != NULL) { - S32 replacement_start; - S32 replacement_length; - LLWString replacement_string; - S32 new_cursor_pos = mCursorPos; - mAutoreplaceCallback(replacement_start, replacement_length, - replacement_string, new_cursor_pos, getWText()); - - if (replacement_length > 0 || !replacement_string.empty()) { - remove(replacement_start, replacement_length, true); - insert(replacement_start, replacement_string, false, - LLTextSegmentPtr()); - setCursorPos(new_cursor_pos); - } - } -} - void LLTextEditor::showEmojiHelper() { if (mReadOnly || !mShowEmojiHelper) @@ -2056,24 +1972,6 @@ bool LLTextEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -bool LLTextEditor::handleUnicodeStringHere(char *uni_str) -{ - auto handled = FALSE; - - if (!mReadOnly) { - addString(uni_str); - getWindow()->hideCursorUntilMouseMove(); - handled = TRUE; - } - - if (handled) { - resetCursorBlink(); - deselect(); - onKeyStroke(); - } - - return handled; -} // virtual bool LLTextEditor::canDoDelete() const diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 24da5c04e5..0b5acf19a1 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -105,7 +105,6 @@ public: virtual bool handleKeyHere(KEY key, MASK mask ); virtual bool handleUnicodeCharHere(llwchar uni_char); - virtual bool handleUnicodeStringHere(char *uni_str); virtual void onMouseCaptureLost(); @@ -250,8 +249,6 @@ protected: // Undoable operations void addChar(llwchar c); // at mCursorPos S32 addChar(S32 pos, llwchar wc); - void addString(char *s); - S32 addString(S32 pos, char *str); void addLineBreakChar(bool group_together = false); S32 overwriteChar(S32 pos, llwchar wc); void removeChar(); @@ -313,7 +310,6 @@ private: // Concrete TextCmd sub-classes used by the LLTextEditor base class class TextCmdInsert; class TextCmdAddChar; - class TextCmdAddString; class TextCmdOverwriteChar; class TextCmdRemove; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index cead5b5956..7d6c937b85 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1080,31 +1080,12 @@ bool LLView::handleUnicodeChar(llwchar uni_char, bool called_from_parent) return handled; } -bool LLView::handleUnicodeString(char *uni_str, bool called_from_parent) -{ - auto handled = FALSE; - - if (getVisible() && getEnabled() && !handled) { - handled = handleUnicodeStringHere(uni_str); - if (handled && LLView::sDebugKeys) - LL_INFOS() << "Unicode key handled by " << getName() << LL_ENDL; - } - - if (!handled && !called_from_parent && mParentView) - handled = mParentView->handleUnicodeString(uni_str, FALSE); - - return handled; -} bool LLView::handleUnicodeCharHere(llwchar uni_char ) { return false; } -bool LLView::handleUnicodeStringHere(char *uni_str) -{ - return FALSE; -} bool LLView::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 7f57a8d7db..710ec3d05e 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -385,7 +385,6 @@ public: /* virtual */ bool handleKey(KEY key, MASK mask, bool called_from_parent); /* virtual */ bool handleKeyUp(KEY key, MASK mask, bool called_from_parent); /* virtual */ bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); - /* virtual */ bool handleUnicodeString(char *uni_str, bool called_from_parent); virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, @@ -519,7 +518,6 @@ public: virtual bool handleKeyHere(KEY key, MASK mask); virtual bool handleKeyUpHere(KEY key, MASK mask); virtual bool handleUnicodeCharHere(llwchar uni_char); - virtual bool handleUnicodeStringHere(char *uni_str); virtual void handleReshape(const LLRect& rect, bool by_user); virtual void dirtyRect(); -- cgit v1.2.3