Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Unified Diff: ui/events/x/device_data_manager_x11.h

Issue 618283003: Adds special support to the device manager for keyboards devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix blocked devices not updating. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6ceff06dae59ee846a1e5177943ba22b71c1be48..40b9e54180e256c90f23ad4ac70843d3fe6e1b37 100644
--- a/ui/events/x/device_data_manager_x11.h
+++ b/ui/events/x/device_data_manager_x11.h
@@ -15,6 +15,7 @@
#include <X11/extensions/XInput2.h>
#include <bitset>
+#include <functional>
#include <map>
#include <set>
#include <vector>
@@ -51,53 +52,53 @@ class EVENTS_BASE_EXPORT DeviceDataManagerX11 : public DeviceDataManager {
enum DataType {
// Define the valuators used the CrOS CMT driver. Used by mice and CrOS
// touchpads.
- DT_CMT_SCROLL_X = 0, // Scroll amount on the X (horizontal) direction.
- DT_CMT_SCROLL_Y, // Scroll amount on the Y (vertical) direction.
- DT_CMT_ORDINAL_X, // Original (unaccelerated) value on the X direction.
- // Can be used both for scrolls and flings.
- DT_CMT_ORDINAL_Y, // Original (unaccelerated) value on the Y direction.
- // Can be used both for scrolls and flings.
- DT_CMT_START_TIME, // Gesture start time.
- DT_CMT_END_TIME, // Gesture end time.
- DT_CMT_FLING_X, // Fling amount on the X (horizontal) direction.
- DT_CMT_FLING_Y, // Fling amount on the Y (vertical) direction.
- DT_CMT_FLING_STATE, // The state of fling gesture (whether the user just
- // start flinging or that he/she taps down).
- DT_CMT_METRICS_TYPE, // Metrics type of the metrics gesture, which are
- // used to wrap interesting patterns that we would
- // like to track via the UMA system.
- DT_CMT_METRICS_DATA1, // Complementary data 1 of the metrics gesture.
- DT_CMT_METRICS_DATA2, // Complementary data 2 of the metrics gesture.
- DT_CMT_FINGER_COUNT, // Finger counts in the current gesture. A same type
- // of gesture can have very different meanings based
- // on that (e.g. 2f scroll v.s. 3f swipe).
+ DT_CMT_SCROLL_X = 0, // Scroll amount on the X (horizontal) direction.
+ DT_CMT_SCROLL_Y, // Scroll amount on the Y (vertical) direction.
+ DT_CMT_ORDINAL_X, // Original (unaccelerated) value on the X direction.
+ // Can be used both for scrolls and flings.
+ DT_CMT_ORDINAL_Y, // Original (unaccelerated) value on the Y direction.
+ // Can be used both for scrolls and flings.
+ DT_CMT_START_TIME, // Gesture start time.
+ DT_CMT_END_TIME, // Gesture end time.
+ DT_CMT_FLING_X, // Fling amount on the X (horizontal) direction.
+ DT_CMT_FLING_Y, // Fling amount on the Y (vertical) direction.
+ DT_CMT_FLING_STATE, // The state of fling gesture (whether the user just
+ // start flinging or that he/she taps down).
+ DT_CMT_METRICS_TYPE, // Metrics type of the metrics gesture, which are
+ // used to wrap interesting patterns that we would
+ // like to track via the UMA system.
+ DT_CMT_METRICS_DATA1, // Complementary data 1 of the metrics gesture.
+ DT_CMT_METRICS_DATA2, // Complementary data 2 of the metrics gesture.
+ DT_CMT_FINGER_COUNT, // Finger counts in the current gesture. A same type
+ // of gesture can have very different meanings based
+ // on that (e.g. 2f scroll v.s. 3f swipe).
// End of CMT data types.
// Beginning of touch data types.
// Define the valuators following the Multi-touch Protocol. Used by
// touchscreen devices.
- DT_TOUCH_MAJOR, // Length of the touch area.
- DT_TOUCH_MINOR, // Width of the touch area.
- DT_TOUCH_ORIENTATION, // Angle between the X-axis and the major axis of the
- // touch area.
- DT_TOUCH_PRESSURE, // Pressure of the touch contact.
+ DT_TOUCH_MAJOR, // Length of the touch area.
+ DT_TOUCH_MINOR, // Width of the touch area.
+ DT_TOUCH_ORIENTATION, // Angle between the X-axis and the major axis of the
+ // touch area.
+ DT_TOUCH_PRESSURE, // Pressure of the touch contact.
- DT_TOUCH_POSITION_X, // Touch X position.
- DT_TOUCH_POSITION_Y, // Touch Y position.
+ DT_TOUCH_POSITION_X, // Touch X position.
+ DT_TOUCH_POSITION_Y, // Touch Y position.
// NOTE for XInput MT: 'Tracking ID' is provided in every touch event to
// track individual touch. 'Tracking ID' is an unsigned 32-bit value and
// is increased for each new touch. It will wrap back to 0 when reaching
// the numerical limit.
- DT_TOUCH_TRACKING_ID, // ID of the touch point.
+ DT_TOUCH_TRACKING_ID, // ID of the touch point.
// Kernel timestamp from touch screen (if available).
DT_TOUCH_RAW_TIMESTAMP,
// End of touch data types.
- DT_LAST_ENTRY // This must come last.
+ DT_LAST_ENTRY // This must come last.
};
// Data struct to store extracted data from an input event.
@@ -238,6 +239,11 @@ class EVENTS_BASE_EXPORT DeviceDataManagerX11 : public DeviceDataManager {
// Returns true if |native_event| should be blocked.
bool IsEventBlocked(const base::NativeEvent& native_event);
+ protected:
+ // DeviceHotplugEventObserver:
+ virtual void OnKeyboardDevicesUpdated(
+ const std::vector<KeyboardDevice>& devices) override;
+
private:
DeviceDataManagerX11();
virtual ~DeviceDataManagerX11();
@@ -300,6 +306,10 @@ class EVENTS_BASE_EXPORT DeviceDataManagerX11 : public DeviceDataManager {
// use this only on touchscreen devices.
std::vector<double> last_seen_valuator_[kMaxDeviceNum][kMaxSlotNum];
+ // Map that stores meta-data for blocked keyboards. This is needed to restore
+ // devices when they are re-enabled.
+ std::map<unsigned int, ui::KeyboardDevice, std::less<int>> blocked_keyboards_;
flackr 2014/10/08 21:58:11 You need to specify the comparator for types where
rsadam 2014/10/09 05:19:03 Done.
+
// X11 atoms cache.
X11AtomCache atom_cache_;

Powered by Google App Engine
This is Rietveld 408576698