# HG changeset patch # User Sam Lantinga # Date 1154246960 0 # Node ID c92e5f3e68d95857212432db892eafd97264506d # Parent f42f10fc309e52e1fe1c377c85bef8cd38b762c1 Hack to stop the beeping Fixed keyboard window focus. diff -r f42f10fc309e -r c92e5f3e68d9 src/video/cocoa/SDL_cocoaevents.m --- a/src/video/cocoa/SDL_cocoaevents.m Sun Jul 30 06:11:52 2006 +0000 +++ b/src/video/cocoa/SDL_cocoaevents.m Sun Jul 30 08:09:20 2006 +0000 @@ -174,7 +174,9 @@ case NSKeyUp: case NSFlagsChanged: 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: [NSApp sendEvent:event]; break; diff -r f42f10fc309e -r c92e5f3e68d9 src/video/cocoa/SDL_cocoawindow.h --- a/src/video/cocoa/SDL_cocoawindow.h Sun Jul 30 06:11:52 2006 +0000 +++ b/src/video/cocoa/SDL_cocoawindow.h Sun Jul 30 08:09:20 2006 +0000 @@ -58,8 +58,6 @@ -(void) rightMouseDragged:(NSEvent *) theEvent; -(void) otherMouseDragged:(NSEvent *) theEvent; -(void) scrollWheel:(NSEvent *) theEvent; --(void) keyDown:(NSEvent *) theEvent; --(void) keyUp:(NSEvent *) theEvent; @end /* *INDENT-ON* */ diff -r f42f10fc309e -r c92e5f3e68d9 src/video/cocoa/SDL_cocoawindow.m --- a/src/video/cocoa/SDL_cocoawindow.m Sun Jul 30 06:11:52 2006 +0000 +++ b/src/video/cocoa/SDL_cocoawindow.m Sun Jul 30 08:09:20 2006 +0000 @@ -127,12 +127,18 @@ - (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 { - SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); + int index; + + index = _data->videodata->keyboard; + SDL_SetKeyboardFocus(index, 0); } - (void)windowDidHide:(NSNotification *)aNotification @@ -254,26 +260,6 @@ 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 static int