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

Unified Diff: content/renderer/pepper/usb_key_code_conversion_win.cc

Issue 100533003: Fix CodeForKeyboardEvent to properly calculate the scancode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/usb_key_code_conversion_win.cc
diff --git a/content/renderer/pepper/usb_key_code_conversion_win.cc b/content/renderer/pepper/usb_key_code_conversion_win.cc
index 21c26abbdb1d57532972677d64486657c5c3920f..c9e0592b843a940d16b4b54317e23cacd25b2815 100644
--- a/content/renderer/pepper/usb_key_code_conversion_win.cc
+++ b/content/renderer/pepper/usb_key_code_conversion_win.cc
@@ -23,8 +23,13 @@ uint32_t UsbKeyCodeForKeyboardEvent(const WebKeyboardEvent& key_event) {
}
const char* CodeForKeyboardEvent(const WebKeyboardEvent& key_event) {
+ // Extract the scancode and extended bit from the native key event's lParam.
+ int scancode = (key_event.nativeKeyCode >> 16) & 0x000000FF;
+ if ((key_event.nativeKeyCode & (1 << 24)) != 0)
+ scancode |= 0xe000;
+
ui::KeycodeConverter* key_converter = ui::KeycodeConverter::GetInstance();
- return key_converter->NativeKeycodeToCode(key_event.nativeKeyCode);
+ return key_converter->NativeKeycodeToCode(scancode);
Wez 2013/12/03 03:02:57 nit: There are equivalent functions in ui/events/k
}
} // namespace content
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698