| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
| 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "ui/events/devices/input_device.h" | 16 #include "ui/events/devices/input_device.h" |
| 17 #include "ui/events/ozone/evdev/event_dispatch_callback.h" | 17 #include "ui/events/ozone/evdev/event_dispatch_callback.h" |
| 18 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 18 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 19 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
| 20 | 20 |
| 21 struct input_event; | 21 struct input_event; |
| 22 | 22 |
| 23 namespace ui { | 23 namespace ui { |
| 24 enum class DomCode; | 24 enum class DomCode; |
| 25 class PalmSuppressionFilter; |
| 25 | 26 |
| 26 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev | 27 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev |
| 27 : public base::MessagePumpLibevent::Watcher { | 28 : public base::MessagePumpLibevent::Watcher { |
| 28 public: | 29 public: |
| 29 EventConverterEvdev(int fd, | 30 EventConverterEvdev(int fd, |
| 30 const base::FilePath& path, | 31 const base::FilePath& path, |
| 31 int id, | 32 int id, |
| 32 InputDeviceType type, | 33 InputDeviceType type, |
| 33 const std::string& name, | 34 const std::string& name, |
| 34 uint16_t vendor_id, | 35 uint16_t vendor_id, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 71 |
| 71 // Returns true if the converter is used for a mouse device; | 72 // Returns true if the converter is used for a mouse device; |
| 72 virtual bool HasMouse() const; | 73 virtual bool HasMouse() const; |
| 73 | 74 |
| 74 // Returns true if the converter is used for a touchpad device. | 75 // Returns true if the converter is used for a touchpad device. |
| 75 virtual bool HasTouchpad() const; | 76 virtual bool HasTouchpad() const; |
| 76 | 77 |
| 77 // Returns true if the converter is used for a touchscreen device. | 78 // Returns true if the converter is used for a touchscreen device. |
| 78 virtual bool HasTouchscreen() const; | 79 virtual bool HasTouchscreen() const; |
| 79 | 80 |
| 81 // Returns true if the converter is used for a pen device. |
| 82 virtual bool HasPen() const; |
| 83 |
| 80 // Returns true if the converter is used for a device with a caps lock LED. | 84 // Returns true if the converter is used for a device with a caps lock LED. |
| 81 virtual bool HasCapsLockLed() const; | 85 virtual bool HasCapsLockLed() const; |
| 82 | 86 |
| 83 // Returns the size of the touchscreen device if the converter is used for a | 87 // Returns the size of the touchscreen device if the converter is used for a |
| 84 // touchscreen device. | 88 // touchscreen device. |
| 85 virtual gfx::Size GetTouchscreenSize() const; | 89 virtual gfx::Size GetTouchscreenSize() const; |
| 86 | 90 |
| 87 // Returns the number of touch points this device supports. Should not be | 91 // Returns the number of touch points this device supports. Should not be |
| 88 // called unless HasTouchscreen() returns true | 92 // called unless HasTouchscreen() returns true |
| 89 virtual int GetTouchPoints() const; | 93 virtual int GetTouchPoints() const; |
| 90 | 94 |
| 91 // Sets which keyboard keys should be processed. If |enable_filter| is | 95 // Sets which keyboard keys should be processed. If |enable_filter| is |
| 92 // false, all keys are allowed and |allowed_keys| is ignored. | 96 // false, all keys are allowed and |allowed_keys| is ignored. |
| 93 virtual void SetKeyFilter(bool enable_filter, | 97 virtual void SetKeyFilter(bool enable_filter, |
| 94 std::vector<DomCode> allowed_keys); | 98 std::vector<DomCode> allowed_keys); |
| 95 | 99 |
| 96 // Update caps lock LED state. | 100 // Update caps lock LED state. |
| 97 virtual void SetCapsLockLed(bool enabled); | 101 virtual void SetCapsLockLed(bool enabled); |
| 98 | 102 |
| 99 // Update touch event logging state. | 103 // Update touch event logging state. |
| 100 virtual void SetTouchEventLoggingEnabled(bool enabled); | 104 virtual void SetTouchEventLoggingEnabled(bool enabled); |
| 101 | 105 |
| 106 // Set palm suppression filter to use on this device. Can be set to nullptr. |
| 107 virtual void SetPalmSuppressionFilter(PalmSuppressionFilter* palm_filter); |
| 108 |
| 102 // Helper to generate a base::TimeTicks from an input_event's time | 109 // Helper to generate a base::TimeTicks from an input_event's time |
| 103 static base::TimeTicks TimeTicksFromInputEvent(const input_event& event); | 110 static base::TimeTicks TimeTicksFromInputEvent(const input_event& event); |
| 104 | 111 |
| 105 protected: | 112 protected: |
| 106 // base::MessagePumpLibevent::Watcher: | 113 // base::MessagePumpLibevent::Watcher: |
| 107 void OnFileCanWriteWithoutBlocking(int fd) override; | 114 void OnFileCanWriteWithoutBlocking(int fd) override; |
| 108 | 115 |
| 109 // File descriptor to read. | 116 // File descriptor to read. |
| 110 int fd_; | 117 int fd_; |
| 111 | 118 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 125 // Controller for watching the input fd. | 132 // Controller for watching the input fd. |
| 126 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 133 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
| 127 | 134 |
| 128 private: | 135 private: |
| 129 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); | 136 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); |
| 130 }; | 137 }; |
| 131 | 138 |
| 132 } // namespace ui | 139 } // namespace ui |
| 133 | 140 |
| 134 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 141 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
| OLD | NEW |