Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Implemented Cocoa key event handling.

  • Loading branch information
slouken committed Jul 30, 2006
1 parent 7dd17d8 commit f78880692f544fd7257f15b68aa785774fc13f5f
@@ -654,6 +654,7 @@ SDL_SendKeyboardKey(int index, Uint8 state, Uint8 scancode, SDLKey key)
event.key.keysym.mod = modstate;
event.key.keysym.unicode = 0;
event.key.windowID = keyboard->focus;
/* FIXME: This doesn't make sense anymore... */
/*
* jk 991215 - Added
*/
@@ -688,7 +689,7 @@ SDL_SendKeyboardText(int index, const char *text)
event.text.type = SDL_TEXTINPUT;
event.text.which = (Uint8) index;
SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
event.key.windowID = keyboard->focus;
event.text.windowID = keyboard->focus;
posted = (SDL_PushEvent(&event) > 0);
}
return (posted);
@@ -89,17 +89,17 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
[appleMenu addItem:[NSMenuItem separatorItem]];

title = [@"Hide " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@/*"h"*/""];

menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@/*"h"*/""];
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];

[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];

[appleMenu addItem:[NSMenuItem separatorItem]];

title = [@"Quit " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@/*"q"*/""];

/* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
@@ -116,7 +116,7 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];

/* "Minimize" item */
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@/*"m"*/""];
[windowMenu addItem:menuItem];
[menuItem release];

@@ -169,7 +169,16 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
if ( event == nil ) {
break;
}
[NSApp sendEvent:event];
switch ([event type]) {
case NSKeyDown:
case NSKeyUp:
case NSFlagsChanged:
Cocoa_HandleKeyEvent(_this, event);
/* Fall through to pass event to NSApp */
default:
[NSApp sendEvent:event];
break;
}
}
[pool release];
}

0 comments on commit f788806

Please sign in to comment.