Fixed the enter and return keys not being sent appropriately as unicode characters.

master
Geenz 2013-01-02 18:53:44 -05:00
parent 966a4c893c
commit 9ce3ab1a52
9 changed files with 22 additions and 10 deletions

View File

@ -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;
}

View File

@ -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]);
}
}
}

View File

@ -93,6 +93,6 @@ void callFocus();
void callFocusLost();
NSWindowRef getMainAppWindow();
GLViewRef getGLView(NSWindowRef window);
GLViewRef getGLView();
unsigned int getModifiers();

View File

@ -291,7 +291,7 @@ NSWindowRef getMainAppWindow()
return winRef;
}
GLViewRef getGLView(NSWindowRef window)
GLViewRef getGLView()
{
return glviewRef;
}

View File

@ -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)

Binary file not shown.

View File

@ -1787,7 +1787,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">852</int>
<int key="maxID">864</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">

View File

@ -12,12 +12,10 @@
@interface LLAppDelegate : NSObject <NSApplicationDelegate> {
LLNSWindow *window;
LLOpenGLView *glview;
NSTimer *frameTimer;
}
@property (assign) IBOutlet LLNSWindow *window;
@property (assign) IBOutlet LLOpenGLView *glview;
- (void) mainLoop;

View File

@ -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];