File tree Expand file tree Collapse file tree 3 files changed +8
-32
lines changed Expand file tree Collapse file tree 3 files changed +8
-32
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ namespace nw {
33
33
namespace {
34
34
35
35
typedef std::map<std::string,std::string> KeyMap;
36
- /*
37
- {
36
+
37
+ static KeyMap keymap = {
38
38
{" `" , " Backquote" },
39
39
{" \\ " , " Backslash" },
40
40
{" [" , " BracketLeft" },
@@ -56,34 +56,6 @@ typedef std::map<std::string,std::string> KeyMap;
56
56
{" MEDIANEXTTRACK" , " MediaTrackNext" },
57
57
{" MEDIAPREVTRACK" , " MediaTrackPrevious" }
58
58
};
59
- */
60
-
61
- static KeyMap InitKeyMap () {
62
- KeyMap result;
63
- result[" `" ] = " Backquote" ;
64
- result[" \\ " ] = " Backslash" ;
65
- result[" [" ] = " BracketLeft" ;
66
- result[" ]" ] = " BracketRight" ;
67
- result[" ," ] = " Comma" ;
68
- result[" =" ] = " Equal" ;
69
- result[" -" ] = " Minus" ;
70
- result[" ." ] = " Period" ;
71
- result[" '" ] = " Quote" ;
72
- result[" ;" ] = " Semicolon" ;
73
- result[" /" ] = " Slash" ;
74
- result[" \n " ] = " Enter" ;
75
- result[" \t " ] = " Tab" ;
76
- result[" UP" ] = " ArrowUp" ;
77
- result[" DOWN" ] = " ArrowDown" ;
78
- result[" LEFT" ] = " ArrowLeft" ;
79
- result[" RIGHT" ] = " ArrowRight" ;
80
- result[" ESC" ] = " Escape" ;
81
- result[" MEDIANEXTTRACK" ] = " MediaTrackNext" ;
82
- result[" MEDIAPREVTRACK" ] = " MediaTrackPrevious" ;
83
- return result;
84
- }
85
-
86
- static KeyMap keymap = InitKeyMap();
87
59
88
60
}
89
61
Original file line number Diff line number Diff line change 208
208
209
209
void MenuItem::SetModifiers (const std::string& modifiers) {
210
210
NSUInteger mask = 0 ;
211
- NSString * nsmodifiers = [NSString stringWithUTF8String: modifiers.c_str ()];
211
+ NSString * nsmodifiers = [NSString stringWithUTF8String: modifiers.c_str ()]. lowercaseString ;
212
212
if ([nsmodifiers rangeOfString: @" shift" ].location != NSNotFound )
213
213
mask = mask|NSShiftKeyMask ;
214
- if ([nsmodifiers rangeOfString: @" cmd" ].location != NSNotFound )
214
+ if ([nsmodifiers rangeOfString: @" cmd" ].location != NSNotFound
215
+ || [nsmodifiers rangeOfString: @" command" ].location != NSNotFound
216
+ || [nsmodifiers rangeOfString: @" super" ].location != NSNotFound )
215
217
mask = mask|NSCommandKeyMask ;
216
218
if ([nsmodifiers rangeOfString: @" alt" ].location != NSNotFound )
217
219
mask = mask|NSAlternateKeyMask ;
Original file line number Diff line number Diff line change 21
21
#include " content/nw/src/api/menuitem/menuitem.h"
22
22
23
23
#include " base/files/file_path.h"
24
+ #include " base/strings/string_util.h"
24
25
#include " base/strings/utf_string_conversions.h"
25
26
#include " base/threading/thread_restrictions.h"
26
27
#include " base/values.h"
@@ -74,6 +75,7 @@ void MenuItem::Create(const base::DictionaryValue& option) {
74
75
enable_shortcut_ = true ;
75
76
// only code for ctrl, shift, alt, super and meta modifiers
76
77
int modifiers_value = ui::EF_NONE;
78
+ modifiers = base::ToLowerASCII (modifiers);
77
79
if (modifiers.find (" ctrl" )!=std::string::npos){
78
80
modifiers_value |= ui::EF_CONTROL_DOWN;
79
81
}
You can’t perform that action at this time.
0 commit comments