OLD | NEW |
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/devices/x11/touch_factory_x11.h" | 5 #include "ui/events/devices/x11/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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 virtual_core_keyboard_device_ = devinfo.deviceid; | 121 virtual_core_keyboard_device_ = devinfo.deviceid; |
122 } | 122 } |
123 | 123 |
124 if (devinfo.use == XIFloatingSlave || devinfo.use == XISlavePointer) { | 124 if (devinfo.use == XIFloatingSlave || devinfo.use == XISlavePointer) { |
125 for (int k = 0; k < devinfo.num_classes; ++k) { | 125 for (int k = 0; k < devinfo.num_classes; ++k) { |
126 XIAnyClassInfo* xiclassinfo = devinfo.classes[k]; | 126 XIAnyClassInfo* xiclassinfo = devinfo.classes[k]; |
127 if (xiclassinfo->type == XITouchClass) { | 127 if (xiclassinfo->type == XITouchClass) { |
128 XITouchClassInfo* tci = | 128 XITouchClassInfo* tci = |
129 reinterpret_cast<XITouchClassInfo*>(xiclassinfo); | 129 reinterpret_cast<XITouchClassInfo*>(xiclassinfo); |
130 // Only care direct touch device (such as touch screen) right now | 130 // Only care direct touch device (such as touch screen) right now |
131 if (tci->mode == XIDirectTouch) | 131 if (tci->mode == XIDirectTouch) { |
132 CacheTouchscreenIds(devinfo.deviceid); | 132 CacheTouchscreenIds(devinfo.deviceid); |
133 if (devinfo.use == XISlavePointer) { | 133 if (devinfo.use == XISlavePointer) { |
134 device_master_id_list_[devinfo.deviceid] = devinfo.attachment; | 134 device_master_id_list_[devinfo.deviceid] = devinfo.attachment; |
135 // If the slave device is direct touch device, we also set its | 135 // If the slave device is direct touch device, we also set its |
136 // master device to be touch device. | 136 // master device to be touch device. |
137 touch_device_lookup_[devinfo.attachment] = true; | 137 touch_device_lookup_[devinfo.attachment] = true; |
138 touch_device_list_[devinfo.attachment] = true; | 138 touch_device_list_[devinfo.attachment] = true; |
139 } | 139 } |
| 140 } |
140 } | 141 } |
141 } | 142 } |
142 } | 143 } |
143 } | 144 } |
144 } | 145 } |
145 | 146 |
146 bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) { | 147 bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) { |
147 DCHECK_EQ(GenericEvent, xev->type); | 148 DCHECK_EQ(GenericEvent, xev->type); |
148 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data); | 149 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data); |
149 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event); | 150 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 std::find_if(touchscreens.begin(), touchscreens.end(), | 314 std::find_if(touchscreens.begin(), touchscreens.end(), |
314 [device_id](const TouchscreenDevice& touchscreen) { | 315 [device_id](const TouchscreenDevice& touchscreen) { |
315 return touchscreen.id == device_id; | 316 return touchscreen.id == device_id; |
316 }); | 317 }); |
317 // Internal displays will have a vid and pid of 0. Ignore them. | 318 // Internal displays will have a vid and pid of 0. Ignore them. |
318 if (it != touchscreens.end() && it->vendor_id && it->product_id) | 319 if (it != touchscreens.end() && it->vendor_id && it->product_id) |
319 touchscreen_ids_.insert(std::make_pair(it->vendor_id, it->product_id)); | 320 touchscreen_ids_.insert(std::make_pair(it->vendor_id, it->product_id)); |
320 } | 321 } |
321 | 322 |
322 } // namespace ui | 323 } // namespace ui |
OLD | NEW |