Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1709)

Unified Diff: ui/events/keycodes/keyboard_code_conversion_mac.mm

Issue 782673002: MacViews: tryjobs for toolkit_views=1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: latest crrev/901823002 Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/ime/text_input_client.h ('k') | ui/views/cocoa/bridged_content_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/keycodes/keyboard_code_conversion_mac.mm
diff --git a/ui/events/keycodes/keyboard_code_conversion_mac.mm b/ui/events/keycodes/keyboard_code_conversion_mac.mm
index 4d5cb1f7c4cefd0f74d7d20db402cbbd6580ea60..ebe7d49dafc92de43e03c389bf75dede1f9be022 100644
--- a/ui/events/keycodes/keyboard_code_conversion_mac.mm
+++ b/ui/events/keycodes/keyboard_code_conversion_mac.mm
@@ -65,7 +65,7 @@ const KeyCodeMap kKeyCodesMap[] = {
{ VKEY_PRINT /* 0x2A */, -1, NSPrintFunctionKey },
{ VKEY_EXECUTE /* 0x2B */, -1, NSExecuteFunctionKey },
{ VKEY_SNAPSHOT /* 0x2C */, -1, NSPrintScreenFunctionKey },
- { VKEY_INSERT /* 0x2D */, -1, NSInsertFunctionKey },
+ { VKEY_INSERT /* 0x2D */, kVK_Help, NSInsertFunctionKey },
{ VKEY_DELETE /* 0x2E */, kVK_ForwardDelete, NSDeleteFunctionKey },
{ VKEY_HELP /* 0x2F */, kVK_Help, kHelpCharCode },
{ VKEY_0 /* 0x30 */, kVK_ANSI_0, '0' },
@@ -475,12 +475,18 @@ int MacKeyCodeForWindowsKeyCode(KeyboardCode keycode,
*us_keyboard_shifted_character = ptr->characterIgnoringAllModifiers;
// Fill in |us_keyboard_shifted_character| according to flags.
- if (flags & NSShiftKeyMask) {
+ if (keycode >= VKEY_A && keycode <= VKEY_Z) {
+ // Letter keys need to consider caps lock.
+ bool shift_pressed = (flags & NSShiftKeyMask) != 0;
+ bool caps_pressed = (flags & NSAlphaShiftKeyMask) != 0;
+ if (shift_pressed != caps_pressed)
+ *us_keyboard_shifted_character = 'A' + (keycode - VKEY_A);
+
+ } else if (flags & NSShiftKeyMask) {
if (keycode >= VKEY_0 && keycode <= VKEY_9) {
*us_keyboard_shifted_character =
kShiftCharsForNumberKeys[keycode - VKEY_0];
- } else if (keycode >= VKEY_A && keycode <= VKEY_Z) {
- *us_keyboard_shifted_character = 'A' + (keycode - VKEY_A);
+
} else {
switch (macKeycode) {
case kVK_ANSI_Grave:
« no previous file with comments | « ui/base/ime/text_input_client.h ('k') | ui/views/cocoa/bridged_content_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698