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 |
70 // Releases the slot ID mapping to tracking ID. | 74 // Releases the slot ID mapping to tracking ID. |
71 void ReleaseSlotForTrackingID(uint32 tracking_id); | 75 void ReleaseSlotForTrackingID(uint32 tracking_id); |
72 | 76 |
73 // Whether any touch device is currently present and enabled. | 77 // Whether any touch device is currently present and enabled. |
74 bool IsTouchDevicePresent(); | 78 bool IsTouchDevicePresent(); |
75 | 79 |
76 // Pairs of <vendor id, product id> of external touch screens. | 80 // Pairs of <vendor id, product id> of external touch screens. |
77 const std::set<std::pair<int, int> >& GetTouchscreenIds() const { | 81 const std::set<std::pair<int, int> >& GetTouchscreenIds() const { |
78 return touchscreen_ids_; | 82 return touchscreen_ids_; |
79 } | 83 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // The list of touch devices. For testing/debugging purposes, a single-pointer | 123 // The list of touch devices. For testing/debugging purposes, a single-pointer |
120 // device (mouse or touch screen without sufficient X/driver support for MT) | 124 // device (mouse or touch screen without sufficient X/driver support for MT) |
121 // can sometimes be treated as a touch device. The key in the map represents | 125 // can sometimes be treated as a touch device. The key in the map represents |
122 // the device id, and the value represents if the device is multi-touch | 126 // the device id, and the value represents if the device is multi-touch |
123 // capable. | 127 // capable. |
124 std::map<int, bool> touch_device_list_; | 128 std::map<int, bool> touch_device_list_; |
125 | 129 |
126 // Touch screen <vid, pid>s. | 130 // Touch screen <vid, pid>s. |
127 std::set<std::pair<int, int> > touchscreen_ids_; | 131 std::set<std::pair<int, int> > touchscreen_ids_; |
128 | 132 |
| 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 |
129 // Device ID of the virtual core keyboard. | 137 // Device ID of the virtual core keyboard. |
130 int virtual_core_keyboard_device_; | 138 int virtual_core_keyboard_device_; |
131 | 139 |
132 SequentialIDGenerator id_generator_; | 140 SequentialIDGenerator id_generator_; |
133 | 141 |
134 DISALLOW_COPY_AND_ASSIGN(TouchFactory); | 142 DISALLOW_COPY_AND_ASSIGN(TouchFactory); |
135 }; | 143 }; |
136 | 144 |
137 } // namespace ui | 145 } // namespace ui |
138 | 146 |
139 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ | 147 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
OLD | NEW |