summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlanwei <lanwei@chromium.org>2015-06-23 15:52:05 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-23 22:52:26 +0000
commit9c44eff0121856eaa54559515418c4dc06a18250 (patch)
tree3c409efd10305efe9cb50543652e9eaa7bc51c7c
parent9760e2120fdbb57aecd8af44928d6a5949629810 (diff)
downloadchromium_src-9c44eff0121856eaa54559515418c4dc06a18250.zip
chromium_src-9c44eff0121856eaa54559515418c4dc06a18250.tar.gz
chromium_src-9c44eff0121856eaa54559515418c4dc06a18250.tar.bz2
Fix touch screen on Linux with or without flag --touch-devices
Using flag --touch-devices=device id or not using it, touch screen should work on Linux, but now only the touch screens with the ids after the this flag will be set as touch screens, and we only use touch inputs from master pointer not from the slave devices, so we are only receiving touch inputs if we set touch-devices equal to the master pointer id. BUG=486492 Review URL: https://codereview.chromium.org/1186833005 Cr-Commit-Position: refs/heads/master@{#335785}
-rw-r--r--ui/events/devices/x11/touch_factory_x11.cc22
-rw-r--r--ui/events/devices/x11/touch_factory_x11.h3
2 files changed, 20 insertions, 5 deletions
diff --git a/ui/events/devices/x11/touch_factory_x11.cc b/ui/events/devices/x11/touch_factory_x11.cc
index a971b10..bd7b157 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 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;
+ }
}
}
diff --git a/ui/events/devices/x11/touch_factory_x11.h b/ui/events/devices/x11/touch_factory_x11.h
index 43174a7..c2e9580 100644
--- a/ui/events/devices/x11/touch_factory_x11.h
+++ b/ui/events/devices/x11/touch_factory_x11.h
@@ -134,6 +134,9 @@ class EVENTS_DEVICES_EXPORT TouchFactory {
SequentialIDGenerator id_generator_;
+ // Associate each device ID with its master device ID.
+ std::map<int, int> device_master_id_list_;
+
DISALLOW_COPY_AND_ASSIGN(TouchFactory);
};