|
138 | 138 | if (mask != 0) {
|
139 | 139 | std::stringstream s;
|
140 | 140 | std::vector<std::string> modifiers;
|
141 |
| - if (mask & NSCommandKeyMask) modifiers.push_back("cmd"); |
142 |
| - if (mask & NSControlKeyMask) modifiers.push_back("ctrl"); |
143 |
| - if (mask & NSAlternateKeyMask) modifiers.push_back("alt"); |
144 |
| - if (mask & NSShiftKeyMask) modifiers.push_back("shift"); |
| 141 | + if (mask & NSEventModifierFlagCommand) modifiers.push_back("cmd"); |
| 142 | + if (mask & NSEventModifierFlagControl) modifiers.push_back("ctrl"); |
| 143 | + if (mask & NSEventModifierFlagOption) modifiers.push_back("alt"); |
| 144 | + if (mask & NSEventModifierFlagShift) modifiers.push_back("shift"); |
| 145 | + if (mask & NSEventModifierFlagFunction) modifiers.push_back("fn"); |
145 | 146 | std::copy(modifiers.begin(), modifiers.end(), std::ostream_iterator<std::string>(s, "+"));
|
146 | 147 | std::string str = s.str();
|
147 |
| - str.erase(str.length()-1); |
| 148 | + if (str.length() > 0) { |
| 149 | + str.erase(str.length()-1); |
| 150 | + } |
148 | 151 | options->SetString("modifiers", str);
|
149 | 152 | }
|
150 | 153 |
|
|
210 | 213 | NSUInteger mask = 0;
|
211 | 214 | NSString* nsmodifiers = [NSString stringWithUTF8String:modifiers.c_str()].lowercaseString;
|
212 | 215 | if([nsmodifiers rangeOfString:@"shift"].location != NSNotFound)
|
213 |
| - mask = mask|NSShiftKeyMask; |
| 216 | + mask = mask|NSEventModifierFlagShift; |
214 | 217 | if([nsmodifiers rangeOfString:@"cmd"].location != NSNotFound
|
215 | 218 | || [nsmodifiers rangeOfString:@"command"].location != NSNotFound
|
216 | 219 | || [nsmodifiers rangeOfString:@"super"].location != NSNotFound)
|
217 |
| - mask = mask|NSCommandKeyMask; |
| 220 | + mask = mask|NSEventModifierFlagCommand; |
218 | 221 | if([nsmodifiers rangeOfString:@"alt"].location != NSNotFound)
|
219 |
| - mask = mask|NSAlternateKeyMask; |
| 222 | + mask = mask|NSEventModifierFlagOption; |
220 | 223 | if([nsmodifiers rangeOfString:@"ctrl"].location != NSNotFound)
|
221 |
| - mask = mask|NSControlKeyMask; |
| 224 | + mask = mask|NSEventModifierFlagControl; |
| 225 | + if([nsmodifiers rangeOfString:@"fn"].location != NSNotFound) |
| 226 | + mask = mask|NSEventModifierFlagFunction; |
222 | 227 | [menu_item_ setKeyEquivalentModifierMask:mask];
|
223 | 228 | }
|
224 | 229 |
|
|
0 commit comments