Chromium Code Reviews| Index: ui/events/x/touch_factory_x11.cc |
| diff --git a/ui/events/x/touch_factory_x11.cc b/ui/events/x/touch_factory_x11.cc |
| index b3cd4dd0617d644c6bcf5849d8a257fe452dd4e9..3f40eb2cf82ae7c077838fb42d60c0ebfb51d547 100644 |
| --- a/ui/events/x/touch_factory_x11.cc |
| +++ b/ui/events/x/touch_factory_x11.cc |
| @@ -91,16 +91,18 @@ void TouchFactory::UpdateDeviceList(Display* display) { |
| // With XI2.1 or older, we allow only single touch devices. |
| XDeviceList dev_list = |
| DeviceListCacheX::GetInstance()->GetXDeviceList(display); |
| - for (int i = 0; i < dev_list.count; i++) { |
| - if (dev_list[i].type) { |
| - XScopedString devtype(XGetAtomName(display, dev_list[i].type)); |
| - if (devtype.string() && !strcmp(devtype.string(), XI_TOUCHSCREEN)) { |
| + Atom xi_touchscreen = XInternAtom(display, XI_TOUCHSCREEN, false); |
| + char* devtype = XGetAtomName(display, xi_touchscreen); |
| + if (devtype) { |
|
dshwang
2013/10/31 15:47:26
Do you think thin if-statement is needed? I want t
sadrul
2013/10/31 15:49:21
Yes. Remove devtype. It's not necessary here.
|
| + for (int i = 0; i < dev_list.count; i++) { |
| + if (dev_list[i].type == xi_touchscreen) { |
| touch_device_lookup_[dev_list[i].id] = true; |
| touch_device_list_[dev_list[i].id] = false; |
| touch_device_available_ = true; |
| } |
| } |
| } |
| + XFree(devtype); |
| #endif |
| // Instead of asking X for the list of devices all the time, let's maintain a |