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

Side by Side Diff: ui/events/x/device_list_cache_x.h

Issue 24482004: events: Make platform specific events code into ui/events/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « ui/events/x/device_data_manager.cc ('k') | ui/events/x/device_list_cache_x.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef UI_BASE_X_DEVICE_LIST_CACHE_X_H_ 5 #ifndef UI_EVENTS_X_DEVICE_LIST_CACHE_X_H_
6 #define UI_BASE_X_DEVICE_LIST_CACHE_X_H_ 6 #define UI_EVENTS_X_DEVICE_LIST_CACHE_X_H_
7 7
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 10
11 #include <map> 11 #include <map>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "ui/base/ui_export.h" 14 #include "ui/events/events_export.h"
15 15
16 template <typename T> struct DefaultSingletonTraits; 16 template <typename T> struct DefaultSingletonTraits;
17 17
18 typedef struct _XDisplay Display; 18 typedef struct _XDisplay Display;
19 19
20 template <typename T> 20 template <typename T>
21 struct DeviceList { 21 struct DeviceList {
22 DeviceList() : devices(NULL), count(0) { 22 DeviceList() : devices(NULL), count(0) {
23 } 23 }
24 T& operator[] (int x) { 24 T& operator[] (int x) {
25 return devices[x]; 25 return devices[x];
26 } 26 }
27 T* devices; 27 T* devices;
28 int count; 28 int count;
29 }; 29 };
30 30
31 typedef struct DeviceList<XDeviceInfo> XDeviceList; 31 typedef struct DeviceList<XDeviceInfo> XDeviceList;
32 typedef struct DeviceList<XIDeviceInfo> XIDeviceList; 32 typedef struct DeviceList<XIDeviceInfo> XIDeviceList;
33 33
34 namespace ui { 34 namespace ui {
35 35
36 // A class to cache the current XInput device list. This minimized the 36 // A class to cache the current XInput device list. This minimized the
37 // round-trip time to the X server whenever such a device list is needed. The 37 // round-trip time to the X server whenever such a device list is needed. The
38 // update function will be called on each incoming XI_HierarchyChanged event. 38 // update function will be called on each incoming XI_HierarchyChanged event.
39 class UI_EXPORT DeviceListCacheX { 39 class EVENTS_EXPORT DeviceListCacheX {
40 public: 40 public:
41 static DeviceListCacheX* GetInstance(); 41 static DeviceListCacheX* GetInstance();
42 42
43 void UpdateDeviceList(Display* display); 43 void UpdateDeviceList(Display* display);
44 44
45 const XDeviceList& GetXDeviceList(Display* display); 45 const XDeviceList& GetXDeviceList(Display* display);
46 const XIDeviceList& GetXI2DeviceList(Display* display); 46 const XIDeviceList& GetXI2DeviceList(Display* display);
47 47
48 private: 48 private:
49 friend struct DefaultSingletonTraits<DeviceListCacheX>; 49 friend struct DefaultSingletonTraits<DeviceListCacheX>;
50 50
51 DeviceListCacheX(); 51 DeviceListCacheX();
52 ~DeviceListCacheX(); 52 ~DeviceListCacheX();
53 53
54 std::map<Display*, XDeviceList> x_dev_list_map_; 54 std::map<Display*, XDeviceList> x_dev_list_map_;
55 std::map<Display*, XIDeviceList> xi_dev_list_map_; 55 std::map<Display*, XIDeviceList> xi_dev_list_map_;
56 56
57 DISALLOW_COPY_AND_ASSIGN(DeviceListCacheX); 57 DISALLOW_COPY_AND_ASSIGN(DeviceListCacheX);
58 }; 58 };
59 59
60 } // namespace ui 60 } // namespace ui
61 61
62 #endif // UI_BASE_X_DEVICE_LIST_CACHE_X_H_ 62 #endif // UI_EVENTS_X_DEVICE_LIST_CACHE_X_H_
63 63
OLDNEW
« no previous file with comments | « ui/events/x/device_data_manager.cc ('k') | ui/events/x/device_list_cache_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698