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

Unified Diff: mojo/services/public/cpp/input_events/lib/input_events_type_converters.cc

Issue 404203003: Distinguish between keystroke and character events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IsCharFromNative() for Mac build Created 6 years, 5 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 | « mojo/examples/window_manager/window_manager.cc ('k') | ui/app_list/views/apps_grid_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/public/cpp/input_events/lib/input_events_type_converters.cc
diff --git a/mojo/services/public/cpp/input_events/lib/input_events_type_converters.cc b/mojo/services/public/cpp/input_events/lib/input_events_type_converters.cc
index cff22d45f3d342ba704be09816f4c3985f7346f9..a5292d3080a65e227efc918181cefe5e76a57a80 100644
--- a/mojo/services/public/cpp/input_events/lib/input_events_type_converters.cc
+++ b/mojo/services/public/cpp/input_events/lib/input_events_type_converters.cc
@@ -141,14 +141,21 @@ TypeConverter<EventPtr, scoped_ptr<ui::Event> >::ConvertTo(
ui::EventType ui_event_type =
TypeConverter<EventType, ui::EventType>::ConvertTo(input->action);
switch (input->action) {
- case EVENT_TYPE_KEY_PRESSED:
- case EVENT_TYPE_KEY_RELEASED:
- ui_event.reset(new ui::KeyEvent(
- ui_event_type,
- static_cast<ui::KeyboardCode>(
- input->key_data->key_code),
- ui::EventFlags(input->flags),
- input->key_data->is_char));
+ case ui::ET_KEY_PRESSED:
+ case ui::ET_KEY_RELEASED:
+ if (input->key_data->is_char) {
+ ui_event.reset(new ui::KeyEvent(
+ static_cast<base::char16>(input->key_data->key_code),
+ static_cast<ui::KeyboardCode>(
+ input->key_data->key_code),
+ input->flags));
+ } else {
+ ui_event.reset(new ui::KeyEvent(
+ ui_event_type,
+ static_cast<ui::KeyboardCode>(
+ input->key_data->key_code),
+ input->flags));
+ }
break;
case EVENT_TYPE_MOUSE_PRESSED:
case EVENT_TYPE_MOUSE_DRAGGED:
« no previous file with comments | « mojo/examples/window_manager/window_manager.cc ('k') | ui/app_list/views/apps_grid_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698