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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 if (!IsXInput2Available()) | 223 if (!IsXInput2Available()) |
224 return; | 224 return; |
225 | 225 |
226 // Update the structs with new valuator information | 226 // Update the structs with new valuator information |
227 XIDeviceList info_list = | 227 XIDeviceList info_list = |
228 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display); | 228 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display); |
229 Atom atoms[DT_LAST_ENTRY]; | 229 Atom atoms[DT_LAST_ENTRY]; |
230 for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type) | 230 for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type) |
231 atoms[data_type] = atom_cache_.GetAtom(kCachedAtoms[data_type]); | 231 atoms[data_type] = atom_cache_.GetAtom(kCachedAtoms[data_type]); |
232 | 232 |
233 // Find all of the master pointers. | |
234 for (int i = 0; i < info_list.count; ++i) { | |
235 XIDeviceInfo* info = info_list.devices + i; | |
236 if (info->use == XIMasterPointer) | |
237 master_pointers_.push_back(info->deviceid); | |
238 } | |
239 | |
233 for (int i = 0; i < info_list.count; ++i) { | 240 for (int i = 0; i < info_list.count; ++i) { |
234 XIDeviceInfo* info = info_list.devices + i; | 241 XIDeviceInfo* info = info_list.devices + i; |
235 | 242 |
236 // We currently handle only slave, non-keyboard devices | 243 // We currently handle only slave, non-keyboard devices |
sadrul
2014/12/22 21:08:59
Can you update |master_pointers_| before this inst
pkotwicz
2014/12/23 00:29:49
Done.
| |
237 if (info->use != XISlavePointer && info->use != XIFloatingSlave) | 244 if (info->use != XISlavePointer && info->use != XIFloatingSlave) |
238 continue; | 245 continue; |
239 | 246 |
240 bool possible_cmt = false; | 247 bool possible_cmt = false; |
241 bool not_cmt = false; | 248 bool not_cmt = false; |
242 const int deviceid = info->deviceid; | 249 const int deviceid = info->deviceid; |
243 | 250 |
244 for (int j = 0; j < info->num_classes; ++j) { | 251 for (int j = 0; j < info->num_classes; ++j) { |
245 if (info->classes[j]->type == XIValuatorClass) | 252 if (info->classes[j]->type == XIValuatorClass) |
246 ++valuator_count_[deviceid]; | 253 ++valuator_count_[deviceid]; |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 } else { | 756 } else { |
750 keyboards.erase(it); | 757 keyboards.erase(it); |
751 ++blocked_iter; | 758 ++blocked_iter; |
752 } | 759 } |
753 } | 760 } |
754 // Notify base class of updated list. | 761 // Notify base class of updated list. |
755 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); | 762 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); |
756 } | 763 } |
757 | 764 |
758 } // namespace ui | 765 } // namespace ui |
OLD | NEW |