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

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

Issue 989993002: x11: Use scoped_ptr<> for X11 objects where it makes sense. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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 | « ui/events/devices/x11/device_list_cache_x11.cc ('k') | ui/gfx/x/x11_types.h » ('j') | 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 4201fa04bf3bdc35136b8400ab443280a7210df9..69fb97c553b75fb8a34c3b1df730a7f6cf0b62c8 100644
--- a/ui/events/devices/x11/touch_factory_x11.cc
+++ b/ui/events/devices/x11/touch_factory_x11.cc
@@ -89,7 +89,7 @@ void TouchFactory::UpdateDeviceList(Display* display) {
// If XInput2 is not supported, this will return null (with count of -1) so
// we assume there cannot be any touch devices.
// With XI2.1 or older, we allow only single touch devices.
- XDeviceList dev_list =
+ const XDeviceList& dev_list =
DeviceListCacheX11::GetInstance()->GetXDeviceList(display);
Atom xi_touchscreen = XInternAtom(display, XI_TOUCHSCREEN, false);
for (int i = 0; i < dev_list.count; i++) {
@@ -115,37 +115,37 @@ void TouchFactory::UpdateDeviceList(Display* display) {
// floating device is not connected to a master device. So it is necessary to
// also select on the floating devices.
pointer_device_lookup_.reset();
- XIDeviceList xi_dev_list =
+ const XIDeviceList& xi_dev_list =
DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display);
for (int i = 0; i < xi_dev_list.count; i++) {
- XIDeviceInfo* devinfo = xi_dev_list.devices + i;
- if (devinfo->use == XIFloatingSlave || devinfo->use == XIMasterPointer) {
- for (int k = 0; k < devinfo->num_classes; ++k) {
- XIAnyClassInfo* xiclassinfo = devinfo->classes[k];
+ const XIDeviceInfo& devinfo = xi_dev_list[i];
+ if (devinfo.use == XIFloatingSlave || devinfo.use == XIMasterPointer) {
+ 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;
+ touch_device_lookup_[devinfo.deviceid] = true;
+ touch_device_list_[devinfo.deviceid] = true;
}
}
}
- pointer_device_lookup_[devinfo->deviceid] = true;
- } else if (devinfo->use == XIMasterKeyboard) {
- virtual_core_keyboard_device_ = devinfo->deviceid;
+ pointer_device_lookup_[devinfo.deviceid] = true;
+ } 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 (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(display, devinfo->deviceid);
+ CacheTouchscreenIds(display, devinfo.deviceid);
}
}
}
« no previous file with comments | « ui/events/devices/x11/device_list_cache_x11.cc ('k') | ui/gfx/x/x11_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698