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_X_TOUCH_FACTORY_X11_H_ | 5 #ifndef UI_EVENTS_X_TOUCH_FACTORY_X11_H_ |
6 #define UI_EVENTS_X_TOUCH_FACTORY_X11_H_ | 6 #define UI_EVENTS_X_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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 // Tries to find an existing slot ID mapping to tracking ID. Returns true | 62 // Tries to find an existing slot ID mapping to tracking ID. Returns true |
63 // if the slot is found and it is saved in |slot|, false if no such slot | 63 // if the slot is found and it is saved in |slot|, false if no such slot |
64 // can be found. | 64 // can be found. |
65 bool QuerySlotForTrackingID(uint32 tracking_id, int* slot); | 65 bool QuerySlotForTrackingID(uint32 tracking_id, int* slot); |
66 | 66 |
67 // Tries to find an existing slot ID mapping to tracking ID. If there | 67 // Tries to find an existing slot ID mapping to tracking ID. If there |
68 // isn't one already, allocates a new slot ID and sets up the mapping. | 68 // isn't one already, allocates a new slot ID and sets up the mapping. |
69 int GetSlotForTrackingID(uint32 tracking_id); | 69 int GetSlotForTrackingID(uint32 tracking_id); |
70 | 70 |
| 71 // Increases the number of times |ReleaseSlotForTrackingID| needs to be called |
| 72 // on a given tracking id before it will actually be released. |
| 73 void AcquireSlotForTrackingID(uint32 tracking_id); |
| 74 |
71 // Releases the slot ID mapping to tracking ID. | 75 // Releases the slot ID mapping to tracking ID. |
72 void ReleaseSlotForTrackingID(uint32 tracking_id); | 76 void ReleaseSlotForTrackingID(uint32 tracking_id); |
73 | 77 |
74 // Whether any touch device is currently present and enabled. | 78 // Whether any touch device is currently present and enabled. |
75 bool IsTouchDevicePresent(); | 79 bool IsTouchDevicePresent(); |
76 | 80 |
77 // Pairs of <vendor id, product id> of external touch screens. | 81 // Pairs of <vendor id, product id> of external touch screens. |
78 const std::set<std::pair<int, int> >& GetTouchscreenIds() const { | 82 const std::set<std::pair<int, int> >& GetTouchscreenIds() const { |
79 return touchscreen_ids_; | 83 return touchscreen_ids_; |
80 } | 84 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // The list of touch devices. For testing/debugging purposes, a single-pointer | 127 // 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) | 128 // 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 | 129 // 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 | 130 // the device id, and the value represents if the device is multi-touch |
127 // capable. | 131 // capable. |
128 std::map<int, bool> touch_device_list_; | 132 std::map<int, bool> touch_device_list_; |
129 | 133 |
130 // Touch screen <vid, pid>s. | 134 // Touch screen <vid, pid>s. |
131 std::set<std::pair<int, int> > touchscreen_ids_; | 135 std::set<std::pair<int, int> > touchscreen_ids_; |
132 | 136 |
| 137 // Maps from a tracking id to the number of times |ReleaseSlotForTrackingID| |
| 138 // must be called before the tracking id is released. |
| 139 std::map<uint32, int> tracking_id_refcounts_; |
| 140 |
133 // Maximum simultaneous touch points supported by device. In the case of | 141 // Maximum simultaneous touch points supported by device. In the case of |
134 // devices with multiple digitizers (e.g. multiple touchscreens), the value | 142 // devices with multiple digitizers (e.g. multiple touchscreens), the value |
135 // is the maximum of the set of maximum supported contacts by each individual | 143 // is the maximum of the set of maximum supported contacts by each individual |
136 // digitizer. | 144 // digitizer. |
137 int max_touch_points_; | 145 int max_touch_points_; |
138 | 146 |
139 SequentialIDGenerator id_generator_; | 147 SequentialIDGenerator id_generator_; |
140 | 148 |
141 DISALLOW_COPY_AND_ASSIGN(TouchFactory); | 149 DISALLOW_COPY_AND_ASSIGN(TouchFactory); |
142 }; | 150 }; |
143 | 151 |
144 } // namespace ui | 152 } // namespace ui |
145 | 153 |
146 #endif // UI_EVENTS_X_TOUCH_FACTORY_X11_H_ | 154 #endif // UI_EVENTS_X_TOUCH_FACTORY_X11_H_ |
OLD | NEW |