| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <AppKit/NSEvent.h> | 5 #include <AppKit/NSEvent.h> |
| 6 #include <Carbon/Carbon.h> | 6 #include <Carbon/Carbon.h> |
| 7 | 7 |
| 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // Alphabetic characters aren't mirrored, go with the raw character. | 212 // Alphabetic characters aren't mirrored, go with the raw character. |
| 213 // [A previous partial comment said something about Dvorak?] | 213 // [A previous partial comment said something about Dvorak?] |
| 214 if (isalpha(rawChar)) | 214 if (isalpha(rawChar)) |
| 215 return rawChar; | 215 return rawChar; |
| 216 | 216 |
| 217 // http://crbug.com/42517 | 217 // http://crbug.com/42517 |
| 218 // http://crbug.com/315379 | 218 // http://crbug.com/315379 |
| 219 // In RTL keyboard layouts, Cocoa mirrors characters in the string | 219 // In RTL keyboard layouts, Cocoa mirrors characters in the string |
| 220 // returned by [event charactersIgnoringModifiers]. In this case, return | 220 // returned by [event charactersIgnoringModifiers]. In this case, return |
| 221 // the raw (unmirrored) char. | 221 // the raw (unmirrored) char. |
| 222 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kCharMapping); ++i) { | 222 for (size_t i = 0; i < arraysize(kCharMapping); ++i) { |
| 223 if (rawChar == kCharMapping[i].rawChar && | 223 if (rawChar == kCharMapping[i].rawChar && |
| 224 noModifiersChar == kCharMapping[i].unmodChar) { | 224 noModifiersChar == kCharMapping[i].unmodChar) { |
| 225 return kCharMapping[i].targetChar; | 225 return kCharMapping[i].targetChar; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). | 229 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). |
| 230 if ([event modifierFlags] & NSAlternateKeyMask) | 230 if ([event modifierFlags] & NSAlternateKeyMask) |
| 231 return rawChar; | 231 return rawChar; |
| 232 } | 232 } |
| 233 | 233 |
| 234 return noModifiersChar; | 234 return noModifiersChar; |
| 235 } | 235 } |
| OLD | NEW |