Hack to stop the beeping
Fixed keyboard window focus. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402008
This commit is contained in:
parent
3123b3cae3
commit
8cff7eb76a
3 changed files with 11 additions and 25 deletions
|
@ -174,7 +174,9 @@ Cocoa_PumpEvents(_THIS)
|
||||||
case NSKeyUp:
|
case NSKeyUp:
|
||||||
case NSFlagsChanged:
|
case NSFlagsChanged:
|
||||||
Cocoa_HandleKeyEvent(_this, event);
|
Cocoa_HandleKeyEvent(_this, event);
|
||||||
/* Fall through to pass event to NSApp */
|
/* Fall through to pass event to NSApp; er, nevermind... */
|
||||||
|
/* FIXME: Find a way to stop the beeping, using delegate */
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
[NSApp sendEvent:event];
|
[NSApp sendEvent:event];
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -58,8 +58,6 @@ typedef struct SDL_WindowData SDL_WindowData;
|
||||||
-(void) rightMouseDragged:(NSEvent *) theEvent;
|
-(void) rightMouseDragged:(NSEvent *) theEvent;
|
||||||
-(void) otherMouseDragged:(NSEvent *) theEvent;
|
-(void) otherMouseDragged:(NSEvent *) theEvent;
|
||||||
-(void) scrollWheel:(NSEvent *) theEvent;
|
-(void) scrollWheel:(NSEvent *) theEvent;
|
||||||
-(void) keyDown:(NSEvent *) theEvent;
|
|
||||||
-(void) keyUp:(NSEvent *) theEvent;
|
|
||||||
@end
|
@end
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
|
|
@ -127,12 +127,18 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||||
|
|
||||||
- (void)windowDidBecomeKey:(NSNotification *)aNotification
|
- (void)windowDidBecomeKey:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
|
int index;
|
||||||
|
|
||||||
|
index = _data->videodata->keyboard;
|
||||||
|
SDL_SetKeyboardFocus(index, _data->windowID);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidResignKey:(NSNotification *)aNotification
|
- (void)windowDidResignKey:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
|
int index;
|
||||||
|
|
||||||
|
index = _data->videodata->keyboard;
|
||||||
|
SDL_SetKeyboardFocus(index, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidHide:(NSNotification *)aNotification
|
- (void)windowDidHide:(NSNotification *)aNotification
|
||||||
|
@ -254,26 +260,6 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||||
SDL_SendMouseWheel(index, (int)([theEvent deltaY]+0.9f));
|
SDL_SendMouseWheel(index, (int)([theEvent deltaY]+0.9f));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)keyDown:(NSEvent *)theEvent
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
|
|
||||||
index = _data->videodata->keyboard;
|
|
||||||
fprintf(stderr, "keyDown\n");
|
|
||||||
const char *text = [[theEvent characters] UTF8String];
|
|
||||||
if(text && *text) {
|
|
||||||
SDL_SendKeyboardText(index, text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)keyUp:(NSEvent *)theEvent
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
|
|
||||||
index = _data->videodata->keyboard;
|
|
||||||
fprintf(stderr, "keyUp\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue