Merge branch 'master' of github.com:LaurentGomila/SFML

This commit is contained in:
Laurent Gomila 2011-09-30 13:44:12 +02:00
commit 35bdbf6e2e
2 changed files with 22 additions and 6 deletions

View File

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

View File

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