From 796d97d1903fb27628a47db447f3463219b649bd Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 14 Dec 2022 20:49:56 +0200 Subject: SL-18384 Fix NSException for keyboard handling Affects accent keys for diacritical marks --- indra/llwindow/llopenglview-objc.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 049226db65..7936245744 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -495,7 +495,12 @@ attributedStringInfo getSegments(NSAttributedString *str) // e.g. OS Window for upload something or Input Window... // mModifiers instance variable is for insertText: or insertText:replacementRange: (by Pell Smit) mModifiers = [theEvent modifierFlags]; - unichar ch = [[theEvent charactersIgnoringModifiers] characterAtIndex:0]; + NSString *str_no_modifiers = [theEvent charactersIgnoringModifiers]; + unichar ch = 0; + if (str_no_modifiers.length) + { + ch = [str_no_modifiers characterAtIndex:0]; + } bool acceptsText = mHasMarkedText ? false : callKeyDown(&eventData, keycode, mModifiers, ch); if (acceptsText && -- cgit v1.2.3 From f1d247809b89d25e480f0e42f098c289da2379bc Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 Feb 2023 23:12:06 +0200 Subject: SL-19190 Laggy behavior when turning GetAsyncKeyState is luggy in some conditions and no longer needed due to fix for SL-16845 - all 'up' keys get reset when leaving window --- indra/llwindow/llkeyboardwin32.cpp | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index 2123ed3939..4c207faa81 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -247,31 +247,9 @@ void LLKeyboardWin32::scanKeyboard() { S32 key; MSG msg; - BOOL pending_key_events = PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD); + PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD); for (key = 0; key < KEY_COUNT; key++) { - // On Windows, verify key down state. JC - // RN: only do this if we don't have further key events in the queue - // as otherwise there might be key repeat events still waiting for this key we are now dumping - if (!pending_key_events && mKeyLevel[key]) - { - // *TODO: I KNOW there must be a better way of - // interrogating the key state than this, using async key - // state can cause ALL kinds of bugs - Doug - if ((key < KEY_BUTTON0) && ((key < '0') || (key > '9'))) - { - // ...under windows make sure the key actually still is down. - // ...translate back to windows key - U16 virtual_key = inverseTranslateExtendedKey(key); - // keydown in highest bit - if (!pending_key_events && !(GetAsyncKeyState(virtual_key) & 0x8000)) - { - //LL_INFOS() << "Key up event missed, resetting" << LL_ENDL; - mKeyLevel[key] = FALSE; - } - } - } - // Generate callback if any event has occurred on this key this frame. // Can't just test mKeyLevel, because this could be a slow frame and // key might have gone down then up. JC -- cgit v1.2.3