From 9ce3ab1a5248423eeea4d843bfb8407ed62b305e Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 2 Jan 2013 18:53:44 -0500 Subject: Fixed the enter and return keys not being sent appropriately as unicode characters. --- indra/llwindow/llkeyboardmacosx.cpp | 2 +- indra/llwindow/llopenglview-objc.mm | 14 +++++++++++++- indra/llwindow/llwindowmacosx-objc.h | 2 +- indra/llwindow/llwindowmacosx-objc.mm | 2 +- indra/llwindow/llwindowmacosx.cpp | 5 ++++- indra/newview/SecondLife.nib | Bin 15670 -> 15670 bytes indra/newview/SecondLife.xib | 2 +- indra/newview/llappviewermacosx-delegate.h | 2 -- indra/newview/llappviewermacosx-delegate.mm | 3 +-- 9 files changed, 22 insertions(+), 10 deletions(-) diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp index 3f357c600e..077ebea909 100644 --- a/indra/llwindow/llkeyboardmacosx.cpp +++ b/indra/llwindow/llkeyboardmacosx.cpp @@ -206,7 +206,7 @@ MASK LLKeyboardMacOSX::updateModifiers(const U32 mask) out_mask |= MASK_SHIFT; } - if(mask & (MAC_CTRL_KEY | MAC_CMD_KEY)) + if(mask & MAC_CTRL_KEY || mask & MAC_CMD_KEY) { out_mask |= MASK_CONTROL; } diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index cb8d7b315f..e5e198b856 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -30,6 +30,11 @@ [super dealloc]; } +- (id) init +{ + return [self initWithFrame:[self bounds] withSamples:2 andVsync:TRUE]; +} + - (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync { @@ -205,7 +210,14 @@ NSString *chars = [theEvent characters]; for (uint i = 0; i < [chars length]; i++) { - callUnicodeCallback([chars characterAtIndex:i], [theEvent modifierFlags]); + // Enter and Return are special cases. + unichar returntest = [chars characterAtIndex:i]; + if ((returntest == NSCarriageReturnCharacter || returntest == NSEnterCharacter) && !([theEvent modifierFlags] & NSCommandKeyMask) && !([theEvent modifierFlags] & NSAlternateKeyMask) && !([theEvent modifierFlags] & NSControlKeyMask)) + { + callUnicodeCallback(returntest, 0); + } else { + callUnicodeCallback([chars characterAtIndex:i], [theEvent modifierFlags]); + } } } diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 655d63ac12..414491f948 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -93,6 +93,6 @@ void callFocus(); void callFocusLost(); NSWindowRef getMainAppWindow(); -GLViewRef getGLView(NSWindowRef window); +GLViewRef getGLView(); unsigned int getModifiers(); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index f3972303f1..5a024eda46 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -291,7 +291,7 @@ NSWindowRef getMainAppWindow() return winRef; } -GLViewRef getGLView(NSWindowRef window) +GLViewRef getGLView() { return glviewRef; } diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index cc0959edf8..902391e170 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -270,7 +270,10 @@ void callDoubleClick(float *pos, MASK mask) void callResize(unsigned int width, unsigned int height) { - gWindowImplementation->getCallbacks()->handleResize(gWindowImplementation, width, height); + if (gWindowImplementation != NULL) + { + gWindowImplementation->getCallbacks()->handleResize(gWindowImplementation, width, height); + } } void callMouseMoved(float *pos, MASK mask) diff --git a/indra/newview/SecondLife.nib b/indra/newview/SecondLife.nib index b2495036a6..cd69b1b812 100644 Binary files a/indra/newview/SecondLife.nib and b/indra/newview/SecondLife.nib differ diff --git a/indra/newview/SecondLife.xib b/indra/newview/SecondLife.xib index 2fc83bd009..212bc5830d 100644 --- a/indra/newview/SecondLife.xib +++ b/indra/newview/SecondLife.xib @@ -1787,7 +1787,7 @@ - 852 + 864 diff --git a/indra/newview/llappviewermacosx-delegate.h b/indra/newview/llappviewermacosx-delegate.h index ac234c14be..848ccbde62 100644 --- a/indra/newview/llappviewermacosx-delegate.h +++ b/indra/newview/llappviewermacosx-delegate.h @@ -12,12 +12,10 @@ @interface LLAppDelegate : NSObject { LLNSWindow *window; - LLOpenGLView *glview; NSTimer *frameTimer; } @property (assign) IBOutlet LLNSWindow *window; -@property (assign) IBOutlet LLOpenGLView *glview; - (void) mainLoop; diff --git a/indra/newview/llappviewermacosx-delegate.mm b/indra/newview/llappviewermacosx-delegate.mm index 5c54736993..7baeeb1de8 100644 --- a/indra/newview/llappviewermacosx-delegate.mm +++ b/indra/newview/llappviewermacosx-delegate.mm @@ -11,7 +11,6 @@ @implementation LLAppDelegate @synthesize window; -@synthesize glview; - (void)dealloc { @@ -23,7 +22,7 @@ frameTimer = nil; setLLNSWindowRef([self window]); - //setLLOpenGLViewRef([self glview]); + if (initViewer()) { frameTimer = [NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(mainLoop) userInfo:nil repeats:YES]; -- cgit v1.2.3