Fixed: #1012 Dead Keys Broken

This commit is contained in:
rti 2010-07-07 02:01:15 +02:00
parent c7840413f0
commit bd131639d5
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 // free the pixel format object
[format release]; [format release];
// let this view receive be target of events
[view becomeFirstResponder];
} }
void ctor() void ctor()
@ -245,6 +242,8 @@ nlWindow setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeabl
setupGLView(view); setupGLView(view);
[[view window] makeFirstResponder:[[view subviews] lastObject]];
return view; return view;
} }
@ -274,6 +273,12 @@ bool setWindowStyle(nlWindow wnd, bool fullscreen)
// pull the view back from fullscreen restoring window options // pull the view back from fullscreen restoring window options
[superview exitFullScreenModeWithOptions:nil]; [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 // 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. TODO check if simply using NSView enterFullScreenMode is a good idea.
the context can be set to full screen as well, performance differences? 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; return true;
@ -785,8 +793,8 @@ void submitEvents(NLMISC::CEventServer& server,
if(!event) if(!event)
break; break;
NSRect viewRect = NSView* glView = [[[[event window] contentView] subviews] lastObject];
[[[[[event window] contentView] subviews] lastObject] frame]; NSRect viewRect = [glView frame];
// TODO this code assumes, that the view fills the window // TODO this code assumes, that the view fills the window
// convert the mouse position to NeL style (relative) // convert the mouse position to NeL style (relative)
@ -798,7 +806,6 @@ void submitEvents(NLMISC::CEventServer& server,
event.type != NSKeyDown && event.type != NSKeyUp) event.type != NSKeyDown && event.type != NSKeyUp)
{ {
[NSApp sendEvent:event]; [NSApp sendEvent:event];
[NSApp updateWindows];
continue; continue;
} }
@ -857,7 +864,6 @@ void submitEvents(NLMISC::CEventServer& server,
nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY,
(NLMISC::TMouseButton)0 /* modifiers */, eventEmitter); (NLMISC::TMouseButton)0 /* modifiers */, eventEmitter);
server.postEvent(nelEvent); server.postEvent(nelEvent);
break; break;
} }

View file

@ -29,28 +29,6 @@
-(id)initWithFrame:(NSRect)frame; -(id)initWithFrame:(NSRect)frame;
-(void)dealloc; -(void)dealloc;
-(BOOL)acceptsFirstResponder;
-(BOOL)needsPanelToBecomeKey;
-(void)keyDown:(NSEvent*)event; -(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 @end

View file

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