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 2552343008: Add slave touch device to touch_device_lookup_ and touch_device_list_ (Closed)
Patch Set: fix a ) Created 3 years, 9 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 | « no previous file | 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 3b91724f4f6a6e8ab31489fe58d92aec9648d434..7df258655eeed9a58f0ec8d99ec25fd13edbfdcb 100644
--- a/ui/events/devices/x11/touch_factory_x11.cc
+++ b/ui/events/devices/x11/touch_factory_x11.cc
@@ -98,44 +98,42 @@ void TouchFactory::UpdateDeviceList(XDisplay* display) {
DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display);
for (int i = 0; i < xi_dev_list.count; i++) {
const XIDeviceInfo& devinfo = xi_dev_list[i];
- if (devinfo.use == XIFloatingSlave || devinfo.use == XIMasterPointer) {
+ if (devinfo.use == XIFloatingSlave || devinfo.use == XIMasterPointer ||
+ devinfo.use == XISlavePointer) {
for (int k = 0; k < devinfo.num_classes; ++k) {
XIAnyClassInfo* xiclassinfo = devinfo.classes[k];
- if (xiclassinfo->type == XITouchClass) {
- XITouchClassInfo* tci =
- reinterpret_cast<XITouchClassInfo*>(xiclassinfo);
- // Only care direct touch device (such as touch screen) right now
- if (tci->mode == XIDirectTouch) {
- touch_device_lookup_[devinfo.deviceid] = true;
- touch_device_list_[devinfo.deviceid] = true;
- }
+ if (xiclassinfo->type != XITouchClass)
+ continue;
+
+ XITouchClassInfo* tci =
+ reinterpret_cast<XITouchClassInfo*>(xiclassinfo);
+ // Only care direct touch device (such as touch screen) right now
+ if (tci->mode != XIDirectTouch)
+ continue;
+
+ int master_id = devinfo.use == XISlavePointer ? devinfo.attachment
+ : devinfo.deviceid;
+
+ if (!IsValidDevice(master_id))
+ continue;
+
+ touch_device_lookup_[master_id] = true;
+ touch_device_list_[master_id] = true;
+
+ if (devinfo.use != XIMasterPointer)
+ CacheTouchscreenIds(devinfo.deviceid);
+
+ if (devinfo.use == XISlavePointer) {
+ device_master_id_list_[devinfo.deviceid] = master_id;
+ touch_device_lookup_[devinfo.deviceid] = true;
+ touch_device_list_[devinfo.deviceid] = false;
}
}
- pointer_device_lookup_[devinfo.deviceid] = true;
+ pointer_device_lookup_[devinfo.deviceid] =
+ (devinfo.use != XISlavePointer);
} else if (devinfo.use == XIMasterKeyboard) {
virtual_core_keyboard_device_ = devinfo.deviceid;
}
-
- if (devinfo.use == XIFloatingSlave || devinfo.use == XISlavePointer) {
- for (int k = 0; k < devinfo.num_classes; ++k) {
- XIAnyClassInfo* xiclassinfo = devinfo.classes[k];
- if (xiclassinfo->type == XITouchClass) {
- XITouchClassInfo* tci =
- reinterpret_cast<XITouchClassInfo*>(xiclassinfo);
- // 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;
- }
- }
- }
- }
- }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698