diff --git a/src/SFML/Window/OSX/SFOpenGLView.mm b/src/SFML/Window/OSX/SFOpenGLView.mm index 9686ee02..7eb45da0 100644 --- a/src/SFML/Window/OSX/SFOpenGLView.mm +++ b/src/SFML/Window/OSX/SFOpenGLView.mm @@ -520,11 +520,13 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask); // Handle text entred event - // We create a new event without command modifiers + // We create a new event without command/ctrl modifiers // to prevent the OS from sending an alert - NSUInteger modifiers = [theEvent modifierFlags] & NSCommandKeyMask - ? [theEvent modifierFlags] & ~NSCommandKeyMask - : [theEvent modifierFlags]; + NSUInteger modifiers = [theEvent modifierFlags]; + + if (modifiers & NSCommandKeyMask) modifiers = modifiers & ~NSCommandKeyMask; + if (modifiers & NSControlKeyMask) modifiers = modifiers & ~NSControlKeyMask; + NSEvent* ev = [NSEvent keyEventWithType:NSKeyDown location:[theEvent locationInWindow] modifierFlags:modifiers diff --git a/src/SFML/Window/OSX/SFWindow.m b/src/SFML/Window/OSX/SFWindow.m index f6ba6e8a..98296aa4 100644 --- a/src/SFML/Window/OSX/SFWindow.m +++ b/src/SFML/Window/OSX/SFWindow.m @@ -32,14 +32,28 @@ @implementation SFWindow //////////////////////////////////////////////////////// --(BOOL)acceptsFirstResponder { +-(BOOL)acceptsFirstResponder +{ return YES; } //////////////////////////////////////////////////////// --(BOOL)canBecomeKeyWindow { +-(BOOL)canBecomeKeyWindow +{ return YES; } +//////////////////////////////////////////////////////// +-(void)keyDown:(NSEvent *)theEvent +{ + // Do nothing except preventing a system alert each time a key is pressed + // + // Special Consideration : + // ----------------------- + // Consider overriding NSResponder -keyDown: message in a Cocoa view/window + // that contains a SFML rendering area. Doing so will prevent a system + // alert to be thrown everytime the user presses a key. +} + @end