summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2026-04-23 16:16:37 +0300
committerGitHub <noreply@github.com>2026-04-23 16:16:37 +0300
commita7c084735ee43d94272d4cebe6894e2ec5cbd8ec (patch)
tree499f9933887dd56cdb4b0bbcc31a6e2b41288eec /indra
parent7d338433d41418ae251919d665c3dab2652b0c26 (diff)
#5450 add Leap non-ascii input support for keyDown
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llwindowlistener.cpp42
1 files changed, 37 insertions, 5 deletions
diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp
index 31005fb734..38e49d0750 100644
--- a/indra/newview/llwindowlistener.cpp
+++ b/indra/newview/llwindowlistener.cpp
@@ -91,7 +91,8 @@ LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter&
&LLWindowListener::getPaths,
LLSDMap("reply", LLSD()));
add("keyDown",
- keySomething + "keypress event.\n" + keyExplain + mask,
+ keySomething + "keypress event.\n" + keyExplain +
+ "The [\"char\"] parameter detects and handles non-ASCII characters seperately\n" + mask,
&LLWindowListener::keyDown);
add("keyUp",
keySomething + "key release event.\n" + keyExplain + mask,
@@ -270,6 +271,20 @@ void LLWindowListener::keyDown(LLSD const & evt)
KEY key = getKEY(evt);
MASK mask = getMask(evt);
+ bool is_non_ascii = false;
+ llwchar uni_char = 0;
+
+ if (evt.has("char"))
+ {
+ LLWString wstr = utf8str_to_wstring(evt["char"].asString());
+ if (!wstr.empty())
+ {
+ uni_char = wstr[0];
+ // If the Unicode code point is outside ASCII range, use Unicode-only handling
+ is_non_ascii = (uni_char >= 0x80);
+ }
+ }
+
if (evt.has("path"))
{
std::string path(evt["path"]);
@@ -284,8 +299,17 @@ void LLWindowListener::keyDown(LLSD const & evt)
response.setResponse(target_view->getInfo());
gFocusMgr.setKeyboardFocus(target_view);
- gViewerInput.handleKey(key, mask, false);
- if(key < 0x80) mWindow->handleUnicodeChar(key, mask);
+
+ if (is_non_ascii)
+ {
+ // For non-ASCII characters, only send the Unicode event
+ mWindow->handleUnicodeChar(uni_char, mask);
+ }
+ else
+ {
+ gViewerInput.handleKey(key, mask, false);
+ if(key < 0x80) mWindow->handleUnicodeChar(key, mask);
+ }
}
else
{
@@ -296,8 +320,16 @@ void LLWindowListener::keyDown(LLSD const & evt)
}
else
{
- gViewerInput.handleKey(key, mask, false);
- if(key < 0x80) mWindow->handleUnicodeChar(key, mask);
+ if (is_non_ascii)
+ {
+ // For non-ASCII characters, only send the Unicode event
+ mWindow->handleUnicodeChar(uni_char, mask);
+ }
+ else
+ {
+ gViewerInput.handleKey(key, mask, false);
+ if(key < 0x80) mWindow->handleUnicodeChar(key, mask);
+ }
}
}