Chromium Code Reviews| Index: ui/events/ozone/evdev/event_device_info.cc |
| diff --git a/ui/events/ozone/evdev/event_device_info.cc b/ui/events/ozone/evdev/event_device_info.cc |
| index aa877e0b18ae4f955bec42af2fbf167bef1841dc..40f8f90a5544c55ffc57057ebd65a313be72609c 100644 |
| --- a/ui/events/ozone/evdev/event_device_info.cc |
| +++ b/ui/events/ozone/evdev/event_device_info.cc |
| @@ -251,6 +251,11 @@ void EventDeviceInfo::SetDeviceType(InputDeviceType type) { |
| device_type_ = type; |
| } |
| +void EventDeviceInfo::SetId(uint16_t vendor_id, uint16_t product_id) { |
| + vendor_id_ = vendor_id; |
| + product_id_ = product_id; |
| +} |
| + |
| bool EventDeviceInfo::HasEventType(unsigned int type) const { |
| if (type > EV_MAX) |
| return false; |
| @@ -427,6 +432,21 @@ bool EventDeviceInfo::HasTouchscreen() const { |
| return HasAbsXY() && HasDirect(); |
| } |
| +bool EventDeviceInfo::HasGamepad() const { |
| + if (!HasEventType(EV_KEY)) |
| + return false; |
| + |
| + // If the device has gamepad button, it will be considered |
| + // as a gamepad. Note: this WILL have false positives and false negatives. A |
|
scottmg
2017/05/01 18:20:51
"it will be considered to be a gamepad."
jkwang
2017/05/01 22:21:56
Done.
|
| + // concrete solution will use ID_INPUT_JOYSTICK with some patch removing false |
|
scottmg
2017/05/01 18:20:51
I don't know anything about Ozone (in fact I can't
jkwang
2017/05/01 22:21:56
ID_INPUT_JOYSTICK itself has false positives. Ther
|
| + // positives. |
| + for (int key = BTN_JOYSTICK; key <= BTN_THUMBR; ++key) |
| + if (HasKeyEvent(key)) |
| + return true; |
| + |
| + return false; |
| +} |
| + |
| EventDeviceInfo::LegacyAbsoluteDeviceType |
| EventDeviceInfo::ProbeLegacyAbsoluteDevice() const { |
| if (!HasAbsXY()) |