OLD | NEW |
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_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ | 5 #ifndef UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
6 #define UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ | 6 #define UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
7 | 7 |
8 #include <bitset> | 8 #include <bitset> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 // Tries to find an existing slot ID mapping to tracking ID. Returns true | 61 // Tries to find an existing slot ID mapping to tracking ID. Returns true |
62 // if the slot is found and it is saved in |slot|, false if no such slot | 62 // if the slot is found and it is saved in |slot|, false if no such slot |
63 // can be found. | 63 // can be found. |
64 bool QuerySlotForTrackingID(uint32 tracking_id, int* slot); | 64 bool QuerySlotForTrackingID(uint32 tracking_id, int* slot); |
65 | 65 |
66 // Tries to find an existing slot ID mapping to tracking ID. If there | 66 // Tries to find an existing slot ID mapping to tracking ID. If there |
67 // isn't one already, allocates a new slot ID and sets up the mapping. | 67 // isn't one already, allocates a new slot ID and sets up the mapping. |
68 int GetSlotForTrackingID(uint32 tracking_id); | 68 int GetSlotForTrackingID(uint32 tracking_id); |
69 | 69 |
70 // Increases the number of times |ReleaseSlotForTrackingID| needs to be called | |
71 // on a given tracking id before it will actually be released. | |
72 void AcquireSlotForTrackingID(uint32 tracking_id); | |
73 | |
74 // Releases the slot ID mapping to tracking ID. | 70 // Releases the slot ID mapping to tracking ID. |
75 void ReleaseSlotForTrackingID(uint32 tracking_id); | 71 void ReleaseSlotForTrackingID(uint32 tracking_id); |
76 | 72 |
77 // Whether any touch device is currently present and enabled. | 73 // Whether any touch device is currently present and enabled. |
78 bool IsTouchDevicePresent(); | 74 bool IsTouchDevicePresent(); |
79 | 75 |
80 // Pairs of <vendor id, product id> of external touch screens. | 76 // Pairs of <vendor id, product id> of external touch screens. |
81 const std::set<std::pair<int, int> >& GetTouchscreenIds() const { | 77 const std::set<std::pair<int, int> >& GetTouchscreenIds() const { |
82 return touchscreen_ids_; | 78 return touchscreen_ids_; |
83 } | 79 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // The list of touch devices. For testing/debugging purposes, a single-pointer | 119 // The list of touch devices. For testing/debugging purposes, a single-pointer |
124 // device (mouse or touch screen without sufficient X/driver support for MT) | 120 // device (mouse or touch screen without sufficient X/driver support for MT) |
125 // can sometimes be treated as a touch device. The key in the map represents | 121 // can sometimes be treated as a touch device. The key in the map represents |
126 // the device id, and the value represents if the device is multi-touch | 122 // the device id, and the value represents if the device is multi-touch |
127 // capable. | 123 // capable. |
128 std::map<int, bool> touch_device_list_; | 124 std::map<int, bool> touch_device_list_; |
129 | 125 |
130 // Touch screen <vid, pid>s. | 126 // Touch screen <vid, pid>s. |
131 std::set<std::pair<int, int> > touchscreen_ids_; | 127 std::set<std::pair<int, int> > touchscreen_ids_; |
132 | 128 |
133 // Maps from a tracking id to the number of times |ReleaseSlotForTrackingID| | |
134 // must be called before the tracking id is released. | |
135 std::map<uint32, int> tracking_id_refcounts_; | |
136 | |
137 // Device ID of the virtual core keyboard. | 129 // Device ID of the virtual core keyboard. |
138 int virtual_core_keyboard_device_; | 130 int virtual_core_keyboard_device_; |
139 | 131 |
140 SequentialIDGenerator id_generator_; | 132 SequentialIDGenerator id_generator_; |
141 | 133 |
142 DISALLOW_COPY_AND_ASSIGN(TouchFactory); | 134 DISALLOW_COPY_AND_ASSIGN(TouchFactory); |
143 }; | 135 }; |
144 | 136 |
145 } // namespace ui | 137 } // namespace ui |
146 | 138 |
147 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ | 139 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
OLD | NEW |