| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 void WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode() | 191 void WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode() |
| 192 { | 192 { |
| 193 const char* id = staticKeyIdentifiers(windowsKeyCode); | 193 const char* id = staticKeyIdentifiers(windowsKeyCode); |
| 194 if (id) { | 194 if (id) { |
| 195 strncpy(keyIdentifier, id, sizeof(keyIdentifier) - 1); | 195 strncpy(keyIdentifier, id, sizeof(keyIdentifier) - 1); |
| 196 keyIdentifier[sizeof(keyIdentifier) - 1] = '\0'; | 196 keyIdentifier[sizeof(keyIdentifier) - 1] = '\0'; |
| 197 } else | 197 } else |
| 198 snprintf(keyIdentifier, sizeof(keyIdentifier), "U+%04X", toupper(windows
KeyCode)); | 198 snprintf(keyIdentifier, sizeof(keyIdentifier), "U+%04X", toupper(windows
KeyCode)); |
| 199 } | 199 } |
| 200 | 200 |
| 201 // static | |
| 202 int WebKeyboardEvent::windowsKeyCodeWithoutLocation(int keycode) | |
| 203 { | |
| 204 switch (keycode) { | |
| 205 case VK_LCONTROL: | |
| 206 case VK_RCONTROL: | |
| 207 return VK_CONTROL; | |
| 208 case VK_LSHIFT: | |
| 209 case VK_RSHIFT: | |
| 210 return VK_SHIFT; | |
| 211 case VK_LMENU: | |
| 212 case VK_RMENU: | |
| 213 return VK_MENU; | |
| 214 default: | |
| 215 return keycode; | |
| 216 } | |
| 217 } | |
| 218 | |
| 219 // static | |
| 220 int WebKeyboardEvent::locationModifiersFromWindowsKeyCode(int keycode) | |
| 221 { | |
| 222 switch (keycode) { | |
| 223 case VK_LCONTROL: | |
| 224 case VK_LSHIFT: | |
| 225 case VK_LMENU: | |
| 226 case VK_LWIN: | |
| 227 return IsLeft; | |
| 228 case VK_RCONTROL: | |
| 229 case VK_RSHIFT: | |
| 230 case VK_RMENU: | |
| 231 case VK_RWIN: | |
| 232 return IsRight; | |
| 233 default: | |
| 234 return 0; | |
| 235 } | |
| 236 } | |
| 237 | |
| 238 } // namespace blink | 201 } // namespace blink |
| OLD | NEW |