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

Side by Side Diff: ui/events/devices/x11/device_data_manager_x11.cc

Issue 685793002: Move all event related devices from ui/events/ to ui/events/devices/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@internal-touchscreens
Patch Set: fix ozone Created 6 years, 1 month 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
OLDNEW
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/x/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
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/sys_info.h" 15 #include "base/sys_info.h"
16 #include "ui/events/devices/keyboard_device.h"
17 #include "ui/events/devices/x11/device_list_cache_x11.h"
18 #include "ui/events/devices/x11/touch_factory_x11.h"
16 #include "ui/events/event_constants.h" 19 #include "ui/events/event_constants.h"
17 #include "ui/events/event_switches.h" 20 #include "ui/events/event_switches.h"
18 #include "ui/events/keyboard_device.h"
19 #include "ui/events/keycodes/keyboard_code_conversion_x.h" 21 #include "ui/events/keycodes/keyboard_code_conversion_x.h"
20 #include "ui/events/x/device_list_cache_x.h"
21 #include "ui/events/x/touch_factory_x11.h"
22 #include "ui/gfx/display.h" 22 #include "ui/gfx/display.h"
23 #include "ui/gfx/point3_f.h" 23 #include "ui/gfx/point3_f.h"
24 #include "ui/gfx/x/x11_types.h" 24 #include "ui/gfx/x/x11_types.h"
25 25
26 // XIScrollClass was introduced in XI 2.1 so we need to define it here 26 // XIScrollClass was introduced in XI 2.1 so we need to define it here
27 // for backward-compatibility with older versions of XInput. 27 // for backward-compatibility with older versions of XInput.
28 #if !defined(XIScrollClass) 28 #if !defined(XIScrollClass)
29 #define XIScrollClass 3 29 #define XIScrollClass 3
30 #endif 30 #endif
31 31
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 valuator_lookup_[i].clear(); 213 valuator_lookup_[i].clear();
214 data_type_lookup_[i].clear(); 214 data_type_lookup_[i].clear();
215 valuator_min_[i].clear(); 215 valuator_min_[i].clear();
216 valuator_max_[i].clear(); 216 valuator_max_[i].clear();
217 for (int j = 0; j < kMaxSlotNum; j++) 217 for (int j = 0; j < kMaxSlotNum; j++)
218 last_seen_valuator_[i][j].clear(); 218 last_seen_valuator_[i][j].clear();
219 } 219 }
220 220
221 // Find all the touchpad devices. 221 // Find all the touchpad devices.
222 XDeviceList dev_list = 222 XDeviceList dev_list =
223 ui::DeviceListCacheX::GetInstance()->GetXDeviceList(display); 223 ui::DeviceListCacheX11::GetInstance()->GetXDeviceList(display);
224 Atom xi_touchpad = XInternAtom(display, XI_TOUCHPAD, false); 224 Atom xi_touchpad = XInternAtom(display, XI_TOUCHPAD, false);
225 for (int i = 0; i < dev_list.count; ++i) 225 for (int i = 0; i < dev_list.count; ++i)
226 if (dev_list[i].type == xi_touchpad) 226 if (dev_list[i].type == xi_touchpad)
227 touchpads_[dev_list[i].id] = true; 227 touchpads_[dev_list[i].id] = true;
228 228
229 if (!IsXInput2Available()) 229 if (!IsXInput2Available())
230 return; 230 return;
231 231
232 // Update the structs with new valuator information 232 // Update the structs with new valuator information
233 XIDeviceList info_list = 233 XIDeviceList info_list =
234 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(display); 234 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display);
235 Atom atoms[DT_LAST_ENTRY]; 235 Atom atoms[DT_LAST_ENTRY];
236 for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type) 236 for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type)
237 atoms[data_type] = atom_cache_.GetAtom(kCachedAtoms[data_type]); 237 atoms[data_type] = atom_cache_.GetAtom(kCachedAtoms[data_type]);
238 238
239 for (int i = 0; i < info_list.count; ++i) { 239 for (int i = 0; i < info_list.count; ++i) {
240 XIDeviceInfo* info = info_list.devices + i; 240 XIDeviceInfo* info = info_list.devices + i;
241 241
242 // We currently handle only slave, non-keyboard devices 242 // We currently handle only slave, non-keyboard devices
243 if (info->use != XISlavePointer && info->use != XIFloatingSlave) 243 if (info->use != XISlavePointer && info->use != XIFloatingSlave)
244 continue; 244 continue;
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } else { 760 } else {
761 keyboards.erase(it); 761 keyboards.erase(it);
762 ++blocked_iter; 762 ++blocked_iter;
763 } 763 }
764 } 764 }
765 // Notify base class of updated list. 765 // Notify base class of updated list.
766 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); 766 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards);
767 } 767 }
768 768
769 } // namespace ui 769 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/devices/x11/device_data_manager_x11.h ('k') | ui/events/devices/x11/device_data_manager_x11_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698