Index: ui/events/devices/x11/touch_factory_x11.h |
diff --git a/ui/events/platform/x11/touch_factory_x11.h b/ui/events/devices/x11/touch_factory_x11.h |
similarity index 72% |
rename from ui/events/platform/x11/touch_factory_x11.h |
rename to ui/events/devices/x11/touch_factory_x11.h |
index ba8519684f6cf19c767b6912a16c8d0f5951f9ba..c2e95802deea66f3cf39312efff3e0a744e3c3f8 100644 |
--- a/ui/events/platform/x11/touch_factory_x11.h |
+++ b/ui/events/devices/x11/touch_factory_x11.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef UI_EVENTS_PLATFORM_X11_TOUCH_FACTORY_X11_H_ |
-#define UI_EVENTS_PLATFORM_X11_TOUCH_FACTORY_X11_H_ |
+#ifndef UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
+#define UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
#include <bitset> |
#include <map> |
@@ -11,12 +11,10 @@ |
#include <utility> |
#include <vector> |
-#include "base/timer/timer.h" |
-#include "ui/events/events_base_export.h" |
+#include "ui/events/devices/events_devices_export.h" |
#include "ui/gfx/sequential_id_generator.h" |
-template <typename T> |
-struct DefaultSingletonTraits; |
+template <typename T> struct DefaultSingletonTraits; |
typedef unsigned long Cursor; |
typedef unsigned long Window; |
@@ -26,7 +24,7 @@ typedef union _XEvent XEvent; |
namespace ui { |
// Functions related to determining touch devices. |
-class EVENTS_BASE_EXPORT TouchFactory { |
+class EVENTS_DEVICES_EXPORT TouchFactory { |
private: |
TouchFactory(); |
~TouchFactory(); |
@@ -51,14 +49,17 @@ class EVENTS_BASE_EXPORT TouchFactory { |
// Keeps a list of touch devices so that it is possible to determine if a |
// pointer event is a touch-event or a mouse-event. The list is reset each |
// time this is called. |
- void SetTouchDeviceList(const std::vector<unsigned int>& devices); |
+ void SetTouchDeviceList(const std::vector<int>& devices); |
+ |
+ // Is the device ID valid? |
+ bool IsValidDevice(int deviceid) const; |
// Is the device a touch-device? |
- bool IsTouchDevice(unsigned int deviceid) const; |
+ bool IsTouchDevice(int deviceid) const; |
// Is the device a real multi-touch-device? (see doc. for |touch_device_list_| |
// below for more explanation.) |
- bool IsMultiTouchDevice(unsigned int deviceid) const; |
+ bool IsMultiTouchDevice(int deviceid) const; |
// Tries to find an existing slot ID mapping to tracking ID. Returns true |
// if the slot is found and it is saved in |slot|, false if no such slot |
@@ -69,10 +70,6 @@ class EVENTS_BASE_EXPORT TouchFactory { |
// isn't one already, allocates a new slot ID and sets up the mapping. |
int GetSlotForTrackingID(uint32 tracking_id); |
- // Increases the number of times |ReleaseSlotForTrackingID| needs to be called |
- // on a given tracking id before it will actually be released. |
- void AcquireSlotForTrackingID(uint32 tracking_id); |
- |
// Releases the slot ID mapping to tracking ID. |
void ReleaseSlotForTrackingID(uint32 tracking_id); |
@@ -80,31 +77,28 @@ class EVENTS_BASE_EXPORT TouchFactory { |
bool IsTouchDevicePresent(); |
// Pairs of <vendor id, product id> of external touch screens. |
- const std::set<std::pair<int, int>>& GetTouchscreenIds() const { |
+ const std::set<std::pair<int, int> >& GetTouchscreenIds() const { |
return touchscreen_ids_; |
} |
- // Return maximum simultaneous touch points supported by device. |
- int GetMaxTouchPoints() const; |
- |
// Resets the TouchFactory singleton. |
void ResetForTest(); |
// Sets up the device id in the list |devices| as multi-touch capable |
// devices and enables touch events processing. This function is only |
// for test purpose, and it does not query from X server. |
- void SetTouchDeviceForTest(const std::vector<unsigned int>& devices); |
+ void SetTouchDeviceForTest(const std::vector<int>& devices); |
// Sets up the device id in the list |devices| as pointer devices. |
// This function is only for test purpose, and it does not query from |
// X server. |
- void SetPointerDeviceForTest(const std::vector<unsigned int>& devices); |
+ void SetPointerDeviceForTest(const std::vector<int>& devices); |
private: |
// Requirement for Singleton |
friend struct DefaultSingletonTraits<TouchFactory>; |
- void CacheTouchscreenIds(Display* display, int id); |
+ void CacheTouchscreenIds(int id); |
// NOTE: To keep track of touch devices, we currently maintain a lookup table |
// to quickly decide if a device is a touch device or not. We also maintain a |
@@ -133,26 +127,19 @@ class EVENTS_BASE_EXPORT TouchFactory { |
std::map<int, bool> touch_device_list_; |
// Touch screen <vid, pid>s. |
- std::set<std::pair<int, int>> touchscreen_ids_; |
- |
- // Maps from a tracking id to the number of times |ReleaseSlotForTrackingID| |
- // must be called before the tracking id is released. |
- std::map<uint32, int> tracking_id_refcounts_; |
- |
- // Maximum simultaneous touch points supported by device. In the case of |
- // devices with multiple digitizers (e.g. multiple touchscreens), the value |
- // is the maximum of the set of maximum supported contacts by each individual |
- // digitizer. |
- int max_touch_points_; |
+ std::set<std::pair<int, int> > touchscreen_ids_; |
// Device ID of the virtual core keyboard. |
int virtual_core_keyboard_device_; |
SequentialIDGenerator id_generator_; |
+ // Associate each device ID with its master device ID. |
+ std::map<int, int> device_master_id_list_; |
+ |
DISALLOW_COPY_AND_ASSIGN(TouchFactory); |
}; |
} // namespace ui |
-#endif // UI_EVENTS_PLATFORM_X11_TOUCH_FACTORY_X11_H_ |
+#endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |