OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/device_data_manager_x11.h" | 5 #include "ui/events/devices/x11/device_data_manager_x11.h" |
6 | 6 |
7 #include <X11/extensions/XInput.h> | 7 #include <X11/extensions/XInput.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 | 10 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 return true; | 195 return true; |
196 } | 196 } |
197 | 197 |
198 bool DeviceDataManagerX11::IsXInput2Available() const { | 198 bool DeviceDataManagerX11::IsXInput2Available() const { |
199 return xi_opcode_ != -1; | 199 return xi_opcode_ != -1; |
200 } | 200 } |
201 | 201 |
202 void DeviceDataManagerX11::UpdateDeviceList(Display* display) { | 202 void DeviceDataManagerX11::UpdateDeviceList(Display* display) { |
203 cmt_devices_.reset(); | 203 cmt_devices_.reset(); |
204 touchpads_.reset(); | 204 touchpads_.reset(); |
| 205 master_pointers_.clear(); |
205 for (int i = 0; i < kMaxDeviceNum; ++i) { | 206 for (int i = 0; i < kMaxDeviceNum; ++i) { |
206 valuator_count_[i] = 0; | 207 valuator_count_[i] = 0; |
207 valuator_lookup_[i].clear(); | 208 valuator_lookup_[i].clear(); |
208 data_type_lookup_[i].clear(); | 209 data_type_lookup_[i].clear(); |
209 valuator_min_[i].clear(); | 210 valuator_min_[i].clear(); |
210 valuator_max_[i].clear(); | 211 valuator_max_[i].clear(); |
211 for (int j = 0; j < kMaxSlotNum; j++) | 212 for (int j = 0; j < kMaxSlotNum; j++) |
212 last_seen_valuator_[i][j].clear(); | 213 last_seen_valuator_[i][j].clear(); |
213 } | 214 } |
214 | 215 |
(...skipping 11 matching lines...) Expand all Loading... |
226 // Update the structs with new valuator information | 227 // Update the structs with new valuator information |
227 XIDeviceList info_list = | 228 XIDeviceList info_list = |
228 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display); | 229 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display); |
229 Atom atoms[DT_LAST_ENTRY]; | 230 Atom atoms[DT_LAST_ENTRY]; |
230 for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type) | 231 for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type) |
231 atoms[data_type] = atom_cache_.GetAtom(kCachedAtoms[data_type]); | 232 atoms[data_type] = atom_cache_.GetAtom(kCachedAtoms[data_type]); |
232 | 233 |
233 for (int i = 0; i < info_list.count; ++i) { | 234 for (int i = 0; i < info_list.count; ++i) { |
234 XIDeviceInfo* info = info_list.devices + i; | 235 XIDeviceInfo* info = info_list.devices + i; |
235 | 236 |
| 237 if (info->use == XIMasterPointer) |
| 238 master_pointers_.push_back(info->deviceid); |
| 239 |
236 // We currently handle only slave, non-keyboard devices | 240 // We currently handle only slave, non-keyboard devices |
237 if (info->use != XISlavePointer && info->use != XIFloatingSlave) | 241 if (info->use != XISlavePointer && info->use != XIFloatingSlave) |
238 continue; | 242 continue; |
239 | 243 |
240 bool possible_cmt = false; | 244 bool possible_cmt = false; |
241 bool not_cmt = false; | 245 bool not_cmt = false; |
242 const int deviceid = info->deviceid; | 246 const int deviceid = info->deviceid; |
243 | 247 |
244 for (int j = 0; j < info->num_classes; ++j) { | 248 for (int j = 0; j < info->num_classes; ++j) { |
245 if (info->classes[j]->type == XIValuatorClass) | 249 if (info->classes[j]->type == XIValuatorClass) |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 } else { | 753 } else { |
750 keyboards.erase(it); | 754 keyboards.erase(it); |
751 ++blocked_iter; | 755 ++blocked_iter; |
752 } | 756 } |
753 } | 757 } |
754 // Notify base class of updated list. | 758 // Notify base class of updated list. |
755 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); | 759 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); |
756 } | 760 } |
757 | 761 |
758 } // namespace ui | 762 } // namespace ui |
OLD | NEW |