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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // The list of touch devices. For testing/debugging purposes, a single-pointer | 122 // The list of touch devices. For testing/debugging purposes, a single-pointer |
127 // device (mouse or touch screen without sufficient X/driver support for MT) | 123 // device (mouse or touch screen without sufficient X/driver support for MT) |
128 // can sometimes be treated as a touch device. The key in the map represents | 124 // can sometimes be treated as a touch device. The key in the map represents |
129 // the device id, and the value represents if the device is multi-touch | 125 // the device id, and the value represents if the device is multi-touch |
130 // capable. | 126 // capable. |
131 std::map<int, bool> touch_device_list_; | 127 std::map<int, bool> touch_device_list_; |
132 | 128 |
133 // Touch screen <vid, pid>s. | 129 // Touch screen <vid, pid>s. |
134 std::set<std::pair<int, int> > touchscreen_ids_; | 130 std::set<std::pair<int, int> > touchscreen_ids_; |
135 | 131 |
136 // Maps from a tracking id to the number of times |ReleaseSlotForTrackingID| | |
137 // must be called before the tracking id is released. | |
138 std::map<uint32, int> tracking_id_refcounts_; | |
139 | |
140 // Maximum simultaneous touch points supported by device. In the case of | 132 // Maximum simultaneous touch points supported by device. In the case of |
141 // devices with multiple digitizers (e.g. multiple touchscreens), the value | 133 // devices with multiple digitizers (e.g. multiple touchscreens), the value |
142 // is the maximum of the set of maximum supported contacts by each individual | 134 // is the maximum of the set of maximum supported contacts by each individual |
143 // digitizer. | 135 // digitizer. |
144 int max_touch_points_; | 136 int max_touch_points_; |
145 | 137 |
146 // Device ID of the virtual core keyboard. | 138 // Device ID of the virtual core keyboard. |
147 int virtual_core_keyboard_device_; | 139 int virtual_core_keyboard_device_; |
148 | 140 |
149 SequentialIDGenerator id_generator_; | 141 SequentialIDGenerator id_generator_; |
150 | 142 |
151 DISALLOW_COPY_AND_ASSIGN(TouchFactory); | 143 DISALLOW_COPY_AND_ASSIGN(TouchFactory); |
152 }; | 144 }; |
153 | 145 |
154 } // namespace ui | 146 } // namespace ui |
155 | 147 |
156 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ | 148 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
OLD | NEW |