From 84f287b34e7d7edbd2e897b73008c782aabe60de Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 17 Jun 2013 12:31:25 -0400 Subject: Moved detecting if we're using a roman-script language to it's own function in the application delegate. Also consider the delete and backspace characters to be special cases. --- indra/llwindow/llopenglview-objc.mm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'indra/llwindow/llopenglview-objc.mm') diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 2afd4993c5..c3f0ef4aeb 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -317,15 +317,21 @@ attributedStringInfo getSegments(NSAttributedString *str) if (!mHasMarkedText) { uint keycode = [theEvent keyCode]; - if (callKeyDown(keycode, mModifiers)) + bool acceptsText = callKeyDown(keycode, mModifiers); + if (acceptsText && + !mMarkedTextAllowed && + ![(LLAppDelegate*)[NSApp delegate] romanScript] && + [[theEvent charactersIgnoringModifiers] characterAtIndex:0] != NSDeleteCharacter && + [[theEvent charactersIgnoringModifiers] characterAtIndex:0] != NSBackspaceCharacter) + { + [(LLAppDelegate*)[NSApp delegate] showInputWindow:true withEvent:theEvent]; + } else { - if (!mMarkedTextAllowed && [[theEvent characters] characterAtIndex:0] != NSBackspaceCharacter) - { - [(LLAppDelegate*)[NSApp delegate] showInputWindow:true withEvent:theEvent]; - } - [[self inputContext] handleEvent:theEvent]; - } else if ([[theEvent charactersIgnoringModifiers] characterAtIndex:0] == 13 || [[theEvent charactersIgnoringModifiers] characterAtIndex:0] == 3) + } + + if ([[theEvent charactersIgnoringModifiers] characterAtIndex:0] == NSCarriageReturnCharacter || + [[theEvent charactersIgnoringModifiers] characterAtIndex:0] == NSEnterCharacter) { // callKeyDown won't return the value we expect for enter or return. Handle them as a separate case. [[self inputContext] handleEvent:theEvent]; @@ -438,7 +444,7 @@ attributedStringInfo getSegments(NSAttributedString *str) mMarkedTextLength = [aString length]; mMarkedText = (NSAttributedString*)[aString mutableString]; } else { - if (mHasMarkedText) + if (mHasMarkedText || ![mMarkedText isEqual: @""]) { [self unmarkText]; } -- cgit v1.2.3