Fixed: #1012 Dead Keys Broken

This commit is contained in:
rti 2010-07-07 02:01:15 +02:00
parent acc6b6ecf1
commit 8366c51608
3 changed files with 15 additions and 41 deletions

View file

@ -149,9 +149,6 @@ static void setupGLView(NSView* superview)
// free the pixel format object
[format release];
// let this view receive be target of events
[view becomeFirstResponder];
}
void ctor()
@ -245,6 +242,8 @@ nlWindow setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeabl
setupGLView(view);
[[view window] makeFirstResponder:[[view subviews] lastObject]];
return view;
}
@ -274,6 +273,12 @@ bool setWindowStyle(nlWindow wnd, bool fullscreen)
// pull the view back from fullscreen restoring window options
[superview exitFullScreenModeWithOptions:nil];
// let the gl view receive key events
[[view window] makeFirstResponder:view];
// bring the window containing the gl view to the front
[[view window] makeKeyAndOrderFront:nil];
}
// enter fullscreen, leave windowed mode
@ -302,6 +307,9 @@ bool setWindowStyle(nlWindow wnd, bool fullscreen)
TODO check if simply using NSView enterFullScreenMode is a good idea.
the context can be set to full screen as well, performance differences?
*/
// let the gl view receive key events
[[view window] makeFirstResponder:view];
}
return true;
@ -785,8 +793,8 @@ void submitEvents(NLMISC::CEventServer& server,
if(!event)
break;
NSRect viewRect =
[[[[[event window] contentView] subviews] lastObject] frame];
NSView* glView = [[[[event window] contentView] subviews] lastObject];
NSRect viewRect = [glView frame];
// TODO this code assumes, that the view fills the window
// convert the mouse position to NeL style (relative)
@ -798,7 +806,6 @@ void submitEvents(NLMISC::CEventServer& server,
event.type != NSKeyDown && event.type != NSKeyUp)
{
[NSApp sendEvent:event];
[NSApp updateWindows];
continue;
}
@ -857,7 +864,6 @@ void submitEvents(NLMISC::CEventServer& server,
nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY,
(NLMISC::TMouseButton)0 /* modifiers */, eventEmitter);
server.postEvent(nelEvent);
break;
}

View file

@ -29,28 +29,6 @@
-(id)initWithFrame:(NSRect)frame;
-(void)dealloc;
-(BOOL)acceptsFirstResponder;
-(BOOL)needsPanelToBecomeKey;
-(void)keyDown:(NSEvent*)event;
/******************************************************************************/
/* NSTextInputClient Protocol */
-(BOOL)hasMarkedText;
-(NSRange)markedRange;
-(NSRange)selectedRange;
-(void)setMarkedText:(id)aString
selectedRange:(NSRange)newSelection
replacementRange:(NSRange)replacementRange;
-(void)unmarkText;
-(NSArray*)validAttributesForMarkedText;
-(NSAttributedString*)attributedSubstringForProposedRange:(NSRange)aRange
actualRange:(NSRangePointer)actualRange;
-(void)insertText:(id)aString replacementRange:(NSRange)replacementRange;
-(NSUInteger)characterIndexForPoint:(NSPoint)aPoint;
-(NSRect)firstRectForCharacterRange:(NSRange)aRange
actualRange:(NSRangePointer)actualRange;
-(void)doCommandBySelector:(SEL)aSelector;
@end

View file

@ -20,7 +20,7 @@
@implementation CocoaOpenGLView
- (id)initWithFrame:(NSRect)frame
-(id)initWithFrame:(NSRect)frame
{
if(self = [super initWithFrame:frame])
{
@ -30,22 +30,12 @@
return nil;
}
- (void)dealloc
-(void)dealloc
{
[characterStorage release];
[super dealloc];
}
-(BOOL)acceptsFirstResponder
{
return YES;
}
-(BOOL)needsPanelToBecomeKey
{
return NO;
}
-(void)keyDown:(NSEvent*)event
{
[[self inputContext] handleEvent:event];