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

Side by Side Diff: ui/events/x/touch_factory_x11.cc

Issue 177843004: Don't lookup touchscreen info for XIMasterPointer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/x/touch_factory_x11.h" 5 #include "ui/events/x/touch_factory_x11.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/XInput.h> 9 #include <X11/extensions/XInput.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 XIDeviceList xi_dev_list = 123 XIDeviceList xi_dev_list =
124 DeviceListCacheX::GetInstance()->GetXI2DeviceList(display); 124 DeviceListCacheX::GetInstance()->GetXI2DeviceList(display);
125 for (int i = 0; i < xi_dev_list.count; i++) { 125 for (int i = 0; i < xi_dev_list.count; i++) {
126 XIDeviceInfo* devinfo = xi_dev_list.devices + i; 126 XIDeviceInfo* devinfo = xi_dev_list.devices + i;
127 if (devinfo->use == XIFloatingSlave || devinfo->use == XIMasterPointer) { 127 if (devinfo->use == XIFloatingSlave || devinfo->use == XIMasterPointer) {
128 #if defined(USE_XI2_MT) 128 #if defined(USE_XI2_MT)
129 for (int k = 0; k < devinfo->num_classes; ++k) { 129 for (int k = 0; k < devinfo->num_classes; ++k) {
130 XIAnyClassInfo* xiclassinfo = devinfo->classes[k]; 130 XIAnyClassInfo* xiclassinfo = devinfo->classes[k];
131 if (xiclassinfo->type == XITouchClass) { 131 if (xiclassinfo->type == XITouchClass) {
132 XITouchClassInfo* tci = 132 XITouchClassInfo* tci =
133 reinterpret_cast<XITouchClassInfo *>(xiclassinfo); 133 reinterpret_cast<XITouchClassInfo*>(xiclassinfo);
134 // Only care direct touch device (such as touch screen) right now 134 // Only care direct touch device (such as touch screen) right now
135 if (tci->mode == XIDirectTouch) { 135 if (tci->mode == XIDirectTouch) {
136 CacheTouchscreenIds(display, devinfo->deviceid);
137 touch_device_lookup_[devinfo->deviceid] = true; 136 touch_device_lookup_[devinfo->deviceid] = true;
138 touch_device_list_[devinfo->deviceid] = true; 137 touch_device_list_[devinfo->deviceid] = true;
139 touch_device_available_ = true; 138 touch_device_available_ = true;
140 if (tci->num_touches > 0 && tci->num_touches > max_touch_points_) 139 if (tci->num_touches > 0 && tci->num_touches > max_touch_points_)
141 max_touch_points_ = tci->num_touches; 140 max_touch_points_ = tci->num_touches;
142 } 141 }
143 } 142 }
144 } 143 }
145 #endif 144 #endif
146 pointer_device_lookup_[devinfo->deviceid] = true; 145 pointer_device_lookup_[devinfo->deviceid] = true;
147 } 146 }
147
148 #if defined(USE_XI2_MT)
149 if (devinfo->use == XIFloatingSlave || devinfo->use == XISlavePointer) {
150 for (int k = 0; k < devinfo->num_classes; ++k) {
151 XIAnyClassInfo* xiclassinfo = devinfo->classes[k];
152 if (xiclassinfo->type == XITouchClass) {
153 XITouchClassInfo* tci =
154 reinterpret_cast<XITouchClassInfo*>(xiclassinfo);
155 // Only care direct touch device (such as touch screen) right now
156 if (tci->mode == XIDirectTouch)
157 CacheTouchscreenIds(display, devinfo->deviceid);
158 }
159 }
160 }
161 #endif
148 } 162 }
149 } 163 }
150 164
151 bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) { 165 bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) {
152 DCHECK_EQ(GenericEvent, xev->type); 166 DCHECK_EQ(GenericEvent, xev->type);
153 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data); 167 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data);
154 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event); 168 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event);
155 169
156 #if defined(USE_XI2_MT) 170 #if defined(USE_XI2_MT)
157 if (event->evtype == XI_TouchBegin || 171 if (event->evtype == XI_TouchBegin ||
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 if (ptr[0] || ptr[1]) 318 if (ptr[0] || ptr[1])
305 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1])); 319 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1]));
306 } 320 }
307 XFree(prop_return); 321 XFree(prop_return);
308 } 322 }
309 323
310 XCloseDevice(display, device); 324 XCloseDevice(display, device);
311 } 325 }
312 326
313 } // namespace ui 327 } // namespace ui
OLDNEW
« 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