Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: ui/events/devices/x11/touch_factory_x11.cc

Issue 1186833005: Fix touch screen on Linux with or without flag --touch-devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change comment Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/devices/x11/touch_factory_x11.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bd7b15714b347899ef7856d469ac04e0891c866f 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;
+ }
}
}
« no previous file with comments | « ui/events/devices/x11/touch_factory_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698