| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_OZONE_PUBLIC_EVENT_FACTORY_OZONE_H_ | 5 #ifndef UI_OZONE_PUBLIC_EVENT_FACTORY_OZONE_H_ |
| 6 #define UI_OZONE_PUBLIC_EVENT_FACTORY_OZONE_H_ | 6 #define UI_OZONE_PUBLIC_EVENT_FACTORY_OZONE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_pump_libevent.h" | 11 #include "base/message_loop/message_pump_libevent.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/ozone/ozone_base_export.h" | 13 #include "ui/ozone/ozone_base_export.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class PointF; | 16 class PointF; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 | 20 |
| 21 class Event; | 21 class Event; |
| 22 | 22 |
| 23 // Creates and dispatches |ui.Event|'s. Ozone assumes that events arrive on file | 23 // Creates and dispatches |ui.Event|'s. Ozone assumes that events arrive on file |
| 24 // descriptors with one |EventConverterOzone| instance for each descriptor. | 24 // descriptors with one |EventConverterOzone| instance for each descriptor. |
| 25 // Ozone presumes that the set of file descriptors can vary at runtime so this | 25 // Ozone presumes that the set of file descriptors can vary at runtime so this |
| 26 // class supports dynamically adding and removing |EventConverterOzone| | 26 // class supports dynamically adding and removing |EventConverterOzone| |
| 27 // instances as necessary. | 27 // instances as necessary. |
| 28 class OZONE_BASE_EXPORT EventFactoryOzone { | 28 class OZONE_BASE_EXPORT EventFactoryOzone { |
| 29 public: | 29 public: |
| 30 |
| 31 // Settings for IndirectTouch (e.g. touchpad) event conversion.. |
| 32 struct IndirectTouchConfiguration { |
| 33 int sensitivity_; |
| 34 bool tap_to_click_; |
| 35 bool three_finger_click_; |
| 36 bool tap_dragging_; |
| 37 bool natural_scroll_; |
| 38 IndirectTouchConfiguration(); |
| 39 }; |
| 40 |
| 41 // Settings for RelXY event (e.g. mice) event conversion. |
| 42 struct RelXYConfiguration { |
| 43 int sensitivity_; |
| 44 bool primary_button_right_; |
| 45 RelXYConfiguration(); |
| 46 }; |
| 47 |
| 48 |
| 30 EventFactoryOzone(); | 49 EventFactoryOzone(); |
| 31 virtual ~EventFactoryOzone(); | 50 virtual ~EventFactoryOzone(); |
| 32 | 51 |
| 33 // Warp the cursor to a location within an AccelerateWidget. | 52 // Warp the cursor to a location within an AccelerateWidget. |
| 34 // If the cursor actually moves, the implementation must dispatch a mouse | 53 // If the cursor actually moves, the implementation must dispatch a mouse |
| 35 // move event with the new location. | 54 // move event with the new location. |
| 36 virtual void WarpCursorTo(gfx::AcceleratedWidget widget, | 55 virtual void WarpCursorTo(gfx::AcceleratedWidget widget, |
| 37 const gfx::PointF& location); | 56 const gfx::PointF& location); |
| 38 | 57 |
| 58 // Indicates if there is a device of the designated type that produces i
ndirect touch events such as a touchpad. |
| 59 virtual bool HasIndirectTouch(); |
| 60 |
| 61 // Sets all IndirectTouch event converters to use the conversion propert
ies specificed by |config| where |mask| is true. |
| 62 virtual void ConfigureIndirectTouchEventConverters(const IndirectTouchCo
nfiguration& config, const IndirectTouchConfiguration& mask); |
| 63 |
| 64 // Indicates if there is a device of the designated type that produces r
elative x/y motion input such as a mouse. |
| 65 virtual bool HasRelXY(); |
| 66 |
| 67 // Sets all RelXY event converters to use the conversion properties spec
ified by |config| where |mask| is true. |
| 68 virtual void ConfigureRelXYEventConverters(const RelXYConfiguration& con
fig, const RelXYConfiguration& mask); |
| 69 |
| 39 // Returns the singleton instance. | 70 // Returns the singleton instance. |
| 40 static EventFactoryOzone* GetInstance(); | 71 static EventFactoryOzone* GetInstance(); |
| 41 | 72 |
| 42 private: | 73 private: |
| 43 static EventFactoryOzone* impl_; // not owned | 74 static EventFactoryOzone* impl_; // not owned |
| 44 | 75 |
| 45 DISALLOW_COPY_AND_ASSIGN(EventFactoryOzone); | 76 DISALLOW_COPY_AND_ASSIGN(EventFactoryOzone); |
| 46 }; | 77 }; |
| 47 | 78 |
| 48 } // namespace ui | 79 } // namespace ui |
| 49 | 80 |
| 50 #endif // UI_OZONE_PUBLIC_EVENT_FACTORY_OZONE_H_ | 81 #endif // UI_OZONE_PUBLIC_EVENT_FACTORY_OZONE_H_ |
| OLD | NEW |