Index: ui/events/event.cc |
diff --git a/ui/events/event.cc b/ui/events/event.cc |
index ffd853b743e631b175d2a9766efaa959d987e1f4..88fba814c296879442ba2a8fb6a7a89182729f35 100644 |
--- a/ui/events/event.cc |
+++ b/ui/events/event.cc |
@@ -135,7 +135,8 @@ Event::Event(EventType type, base::TimeDelta time_stamp, int flags) |
cancelable_(true), |
target_(NULL), |
phase_(EP_PREDISPATCH), |
- result_(ER_UNHANDLED) { |
+ result_(ER_UNHANDLED), |
+ source_device_id_(ED_UNKNOWN_DEVICE) { |
if (type_ < ET_LAST) |
name_ = EventTypeName(type_); |
} |
@@ -151,7 +152,8 @@ Event::Event(const base::NativeEvent& native_event, |
cancelable_(true), |
target_(NULL), |
phase_(EP_PREDISPATCH), |
- result_(ER_UNHANDLED) { |
+ result_(ER_UNHANDLED), |
+ source_device_id_(ED_UNKNOWN_DEVICE) { |
base::TimeDelta delta = EventTimeForNow() - time_stamp_; |
if (type_ < ET_LAST) |
name_ = EventTypeName(type_); |
@@ -167,6 +169,14 @@ Event::Event(const base::NativeEvent& native_event, |
100, |
base::HistogramBase::kUmaTargetedHistogramFlag); |
counter_for_type->Add(delta.InMicroseconds()); |
+ |
+#if defined(USE_X11) |
+ if (native_event->type == GenericEvent) { |
+ XIDeviceEvent* xiev = |
+ static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
+ source_device_id_ = xiev->deviceid; |
+ } |
+#endif |
} |
Event::Event(const Event& copy) |
@@ -179,7 +189,8 @@ Event::Event(const Event& copy) |
cancelable_(true), |
target_(NULL), |
phase_(EP_PREDISPATCH), |
- result_(ER_UNHANDLED) { |
+ result_(ER_UNHANDLED), |
+ source_device_id_(copy.source_device_id_) { |
if (type_ < ET_LAST) |
name_ = EventTypeName(type_); |
} |
@@ -406,8 +417,7 @@ TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
radius_x_(GetTouchRadiusX(native_event)), |
radius_y_(GetTouchRadiusY(native_event)), |
rotation_angle_(GetTouchAngle(native_event)), |
- force_(GetTouchForce(native_event)), |
- source_device_id_(-1) { |
+ force_(GetTouchForce(native_event)) { |
latency()->AddLatencyNumberWithTimestamp( |
INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
0, |
@@ -415,11 +425,6 @@ TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), |
1); |
-#if defined(USE_X11) |
- XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
- source_device_id_ = xiev->deviceid; |
-#endif |
- |
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
} |
@@ -432,8 +437,7 @@ TouchEvent::TouchEvent(EventType type, |
radius_x_(0.0f), |
radius_y_(0.0f), |
rotation_angle_(0.0f), |
- force_(0.0f), |
- source_device_id_(-1) { |
+ force_(0.0f) { |
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
} |
@@ -451,8 +455,7 @@ TouchEvent::TouchEvent(EventType type, |
radius_x_(radius_x), |
radius_y_(radius_y), |
rotation_angle_(angle), |
- force_(force), |
- source_device_id_(-1) { |
+ force_(force) { |
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
} |
@@ -564,7 +567,8 @@ uint16 KeyEvent::GetCharacter() const { |
return GetCharacterFromKeyCode(key_code_, flags()); |
DCHECK(native_event()->type == KeyPress || |
- native_event()->type == KeyRelease); |
+ native_event()->type == KeyRelease || |
+ native_event()->type == GenericEvent); |
sadrul
2014/06/26 12:34:20
Also add a check that native_event()->xgeneric.evt
kpschoedel
2014/06/26 17:24:10
Done.
|
// When a control key is held, prefer ASCII characters to non ASCII |
// characters in order to use it for shortcut keys. GetCharacterFromKeyCode |