Index: ui/events/devices/x11/touch_factory_x11.cc |
diff --git a/ui/events/devices/x11/touch_factory_x11.cc b/ui/events/devices/x11/touch_factory_x11.cc |
index a971b1033afc73a6d6ce22b8b835a98d554ed452..d5dff18bbdeaa84fc81c5b6ddaae0039d0bdb302 100644 |
--- a/ui/events/devices/x11/touch_factory_x11.cc |
+++ b/ui/events/devices/x11/touch_factory_x11.cc |
@@ -130,6 +130,13 @@ void TouchFactory::UpdateDeviceList(Display* display) { |
// Only care direct touch device (such as touch screen) right now |
if (tci->mode == XIDirectTouch) |
CacheTouchscreenIds(devinfo.deviceid); |
+ if (devinfo.use == XISlavePointer) { |
+ device_master_id_list_[devinfo.deviceid] = devinfo.attachment; |
+ // If the slave device is direct touch device, we also set its |
+ // master device to be touch device. |
+ touch_device_lookup_[devinfo.attachment] = true; |
+ touch_device_list_[devinfo.attachment] = true; |
+ } |
} |
} |
} |
@@ -219,11 +226,16 @@ void TouchFactory::SetupXI2ForXWindow(Window window) { |
void TouchFactory::SetTouchDeviceList(const std::vector<int>& devices) { |
touch_device_lookup_.reset(); |
touch_device_list_.clear(); |
- for (std::vector<int>::const_iterator iter = devices.begin(); |
- iter != devices.end(); ++iter) { |
- DCHECK(IsValidDevice(*iter)); |
- touch_device_lookup_[*iter] = true; |
- touch_device_list_[*iter] = false; |
+ for (int deviceid : devices) { |
+ DCHECK(IsValidDevice(deviceid)); |
+ touch_device_lookup_[deviceid] = true; |
+ touch_device_list_[deviceid] = false; |
+ if (device_master_id_list_.find(deviceid) != device_master_id_list_.end()) { |
+ // When we set the device through the "--touch-devices" flag to salve |
sadrul
2015/06/23 20:06:09
*slave
|
+ // touch device, we also set its master device to be touch device. |
+ touch_device_lookup_[device_master_id_list_[deviceid]] = true; |
+ touch_device_list_[device_master_id_list_[deviceid]] = false; |
+ } |
} |
} |