Chromium Code Reviews| Index: ui/events/x/device_data_manager_x11.h |
| diff --git a/ui/events/x/device_data_manager_x11.h b/ui/events/x/device_data_manager_x11.h |
| index 02da999a1cdffcc3e89bf43bade9d82183e6ca3c..45549fb01c57c522144026acb5dd317fbadb3bbb 100644 |
| --- a/ui/events/x/device_data_manager_x11.h |
| +++ b/ui/events/x/device_data_manager_x11.h |
| @@ -149,6 +149,17 @@ class EVENTS_BASE_EXPORT DeviceDataManagerX11 : public DeviceDataManager { |
| // is a CMT event (e.g. it could be a mouse pointer move). |
| bool IsCMTDeviceEvent(const base::NativeEvent& native_event) const; |
| + // Check if the event comes from devices that have a ScrollClass (ie. support |
| + // smooth scrolling). |
| + bool IsScrollClassEvent(const base::NativeEvent& native_event) const; |
| + |
| + // Check if the device has a vertical ScrollClass |
| + bool IsScrollClassVerticalDevice(const base::NativeEvent& native_event) const; |
| + |
| + // Check if the device has a horizontal ScrollClass |
| + bool IsScrollClassHorizontalDevice( |
| + const base::NativeEvent& native_event) const; |
| + |
|
sadrul
2014/12/22 17:11:12
Instead of these three, let's have a single
Scr
|
| // Check if the event is one of the CMT gesture events (scroll, fling, |
| // metrics etc.). |
| bool IsCMTGestureEvent(const base::NativeEvent& native_event) const; |
| @@ -171,6 +182,17 @@ class EVENTS_BASE_EXPORT DeviceDataManagerX11 : public DeviceDataManager { |
| float* y_offset_ordinal, |
| int* finger_count); |
| + // Extract data from a scroll class event (smooth scrolling). User must |
| + // first verify the event type with IsScrollClassEvent. |
| + // Pointers shouldn't be NULL. |
| + void GetScrollClassOffsets(const base::NativeEvent& native_event, |
| + double* x_offset, |
| + double* y_offset); |
|
sadrul
2014/12/22 17:11:12
indenting is off
|
| + |
| + // Invalidate stored scroll class counters, since they can change when |
| + // pointing at other windows. |
| + void InvalidateScrollClasses(); |
| + |
| // Extract data from a fling event. User must first verify the event type |
| // with IsFlingEvent. Pointers shouldn't be NULL. |
| void GetFlingData(const base::NativeEvent& native_event, |
| @@ -208,6 +230,15 @@ class EVENTS_BASE_EXPORT DeviceDataManagerX11 : public DeviceDataManager { |
| const DataType type, |
| double* value); |
| + // Normalize the scroll amount according to the increment size. |
| + // *value /= increment |
| + // *value is expected to be 1 or -1. |
| + // Returns true and sets the normalized value in |value| if normalization is |
| + // successful. Returns false and |value| is unchanged otherwise. |
| + bool NormalizeScrollData(unsigned int deviceid, |
| + bool horizontal, |
| + double* value); |
|
sadrul
2014/12/22 17:11:12
indent
|
| + |
| // Extract the range of the data type. Return true if the range is available |
| // and written into min & max, false if the range is not available. |
| bool GetDataRange(unsigned int deviceid, |
| @@ -273,6 +304,7 @@ class EVENTS_BASE_EXPORT DeviceDataManagerX11 : public DeviceDataManager { |
| // should be processed. |
| std::bitset<kMaxDeviceNum> cmt_devices_; |
| std::bitset<kMaxDeviceNum> touchpads_; |
| + std::bitset<kMaxDeviceNum> scrollclass_devices_; |
| // A quick lookup table for determining if events from the XI device |
| // should be blocked. |
| @@ -288,6 +320,34 @@ class EVENTS_BASE_EXPORT DeviceDataManagerX11 : public DeviceDataManager { |
| // by valuator_lookup_[device_id][data_type]. |
| std::vector<int> valuator_lookup_[kMaxDeviceNum]; |
| + // Index table to find the horizontal scroll valuator number from the device |
| + // ID. |
| + int scroll_horizontal_number_[kMaxDeviceNum]; |
| + |
| + // Index table to find the vertical scroll valuator number from the device |
| + // ID. |
| + int scroll_vertical_number_[kMaxDeviceNum]; |
| + |
| + // Index table to find the horizontal scroll increment from the device ID. |
| + double scroll_horizontal_increment_[kMaxDeviceNum]; |
| + |
| + // Index table to find the vertical scroll increment from the device ID. |
| + double scroll_vertical_increment_[kMaxDeviceNum]; |
| + |
| + // Current horizontal scroll position; used to find the difference between |
| + // events. |
| + double scroll_horizontal_position_[kMaxDeviceNum]; |
| + |
| + // Current vertical scroll position; used to find the difference between |
| + // events. |
| + double scroll_vertical_position_[kMaxDeviceNum]; |
| + |
| + // If true, then a horizontal scroll has been seen on this device. |
| + bool scroll_horizontal_seen_[kMaxDeviceNum]; |
| + |
| + // If true, then a vertical scroll has been seen on this device. |
| + bool scroll_vertical_seen_[kMaxDeviceNum]; |
| + |
|
sadrul
2014/12/22 17:11:12
Having to maintain all these scroll specific info
|
| // Index table to find the DataType for valuator on the specific device |
| // by data_type_lookup_[device_id][valuator]. |
| std::vector<int> data_type_lookup_[kMaxDeviceNum]; |