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..81a2df09afd2b156a162a4286a8f23b8ad13bf2a 100644 |
| --- a/ui/events/ozone/evdev/event_device_info.cc |
| +++ b/ui/events/ozone/evdev/event_device_info.cc |
| @@ -427,6 +427,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 |
| + // concrete solution will use ID_INPUT_JOYSTICK with some patch remving false |
|
spang
2017/04/21 05:38:46
typo: removing
jkwang
2017/04/25 21:16:41
Done.
|
| + // positives. |
| + for (int key = BTN_JOYSTICK; key <= BTN_THUMBR; ++key) |
|
spang
2017/05/03 22:00:37
Please add braces around all multiline blocks. The
jkwang
2017/05/05 00:07:45
Done.
|
| + if (HasKeyEvent(key)) |
| + return true; |
| + |
| + return false; |
| +} |
| + |
| EventDeviceInfo::LegacyAbsoluteDeviceType |
| EventDeviceInfo::ProbeLegacyAbsoluteDevice() const { |
| if (!HasAbsXY()) |