| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <X11/extensions/XInput.h> | 8 #include <X11/extensions/XInput.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 scroll_data_[i].horizontal.seen = false; | 236 scroll_data_[i].horizontal.seen = false; |
| 237 scroll_data_[i].vertical.number = -1; | 237 scroll_data_[i].vertical.number = -1; |
| 238 scroll_data_[i].vertical.seen = false; | 238 scroll_data_[i].vertical.seen = false; |
| 239 for (int j = 0; j < kMaxSlotNum; j++) | 239 for (int j = 0; j < kMaxSlotNum; j++) |
| 240 last_seen_valuator_[i][j].clear(); | 240 last_seen_valuator_[i][j].clear(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 // Find all the touchpad devices. | 243 // Find all the touchpad devices. |
| 244 const XDeviceList& dev_list = | 244 const XDeviceList& dev_list = |
| 245 ui::DeviceListCacheX11::GetInstance()->GetXDeviceList(display); | 245 ui::DeviceListCacheX11::GetInstance()->GetXDeviceList(display); |
| 246 Atom xi_touchpad = ui::X11AtomCache::GetInstance()->GetAtom(XI_TOUCHPAD); | 246 Atom xi_touchpad = gfx::GetAtom(XI_TOUCHPAD); |
| 247 for (int i = 0; i < dev_list.count; ++i) | 247 for (int i = 0; i < dev_list.count; ++i) |
| 248 if (dev_list[i].type == xi_touchpad) | 248 if (dev_list[i].type == xi_touchpad) |
| 249 touchpads_[dev_list[i].id] = true; | 249 touchpads_[dev_list[i].id] = true; |
| 250 | 250 |
| 251 if (!IsXInput2Available()) | 251 if (!IsXInput2Available()) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 // Update the structs with new valuator information | 254 // Update the structs with new valuator information |
| 255 const XIDeviceList& info_list = | 255 const XIDeviceList& info_list = |
| 256 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display); | 256 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display); |
| 257 Atom atoms[DT_LAST_ENTRY]; | 257 Atom atoms[DT_LAST_ENTRY]; |
| 258 for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type) | 258 for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type) |
| 259 atoms[data_type] = | 259 atoms[data_type] = gfx::GetAtom(kCachedAtoms[data_type]); |
| 260 ui::X11AtomCache::GetInstance()->GetAtom(kCachedAtoms[data_type]); | |
| 261 | 260 |
| 262 for (int i = 0; i < info_list.count; ++i) { | 261 for (int i = 0; i < info_list.count; ++i) { |
| 263 const XIDeviceInfo& info = info_list[i]; | 262 const XIDeviceInfo& info = info_list[i]; |
| 264 | 263 |
| 265 if (info.use == XIMasterPointer) | 264 if (info.use == XIMasterPointer) |
| 266 master_pointers_.push_back(info.deviceid); | 265 master_pointers_.push_back(info.deviceid); |
| 267 | 266 |
| 268 // We currently handle only slave, non-keyboard devices | 267 // We currently handle only slave, non-keyboard devices |
| 269 if (info.use != XISlavePointer && info.use != XIFloatingSlave) | 268 if (info.use != XISlavePointer && info.use != XIFloatingSlave) |
| 270 continue; | 269 continue; |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 } else { | 895 } else { |
| 897 keyboards.erase(it); | 896 keyboards.erase(it); |
| 898 ++blocked_iter; | 897 ++blocked_iter; |
| 899 } | 898 } |
| 900 } | 899 } |
| 901 // Notify base class of updated list. | 900 // Notify base class of updated list. |
| 902 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); | 901 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); |
| 903 } | 902 } |
| 904 | 903 |
| 905 } // namespace ui | 904 } // namespace ui |
| OLD | NEW |