Skip to content

Commit

Permalink
[OSX] Fix mnemonics support
Browse files Browse the repository at this point in the history
  • Loading branch information
milani committed Nov 6, 2012
1 parent 0c6a9eb commit 8b53576
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ var normalizeItems = function(options){

var normalizeMnemonic = function(options){

// OSX does not support mnemonics for menu,
// it only supports submenu mnemonics
if( process.platform = 'darwin') {
for(i in options) {
options[i]['label'] = options[i]['label'].replace(/(&)(\w)/g,'$2');
}
}

if( process.platform != 'linux') {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/native_menu/native_menu_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ - (void)handleAction:(id)sender {
[menuItem setImage:[[NSImage alloc] initByReferencingFile:icon]];
}
[menuItem setEnabled:YES];
[menuItem setTitleWithMnemonic:label];

Settings* subsettings = new Settings(item->getObject("submenu"));
NSMenu* submenu = [[NSMenu alloc] initWithTitle:label];
Expand Down

0 comments on commit 8b53576

Please sign in to comment.