1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_
6 #define UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_
10 #include "base/time/time.h"
11 #include "ui/events/devices/input_device.h"
12 #include "ui/events/devices/keyboard_device.h"
13 #include "ui/events/devices/touchscreen_device.h"
14 #include "ui/events/event_constants.h"
15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
16 #include "ui/gfx/geometry/point_f.h"
17 #include "ui/gfx/geometry/vector2d.h"
18 #include "ui/gfx/geometry/vector2d_f.h"
22 struct EVENTS_OZONE_EVDEV_EXPORT KeyEventParams
{
23 KeyEventParams(int device_id
,
26 bool suppress_auto_repeat
,
27 base::TimeDelta timestamp
);
28 KeyEventParams(const KeyEventParams
& other
);
34 bool suppress_auto_repeat
;
35 base::TimeDelta timestamp
;
38 struct EVENTS_OZONE_EVDEV_EXPORT MouseMoveEventParams
{
39 MouseMoveEventParams(int device_id
,
40 const gfx::PointF
& location
,
41 base::TimeDelta timestamp
);
42 MouseMoveEventParams(const MouseMoveEventParams
& other
);
43 ~MouseMoveEventParams();
47 base::TimeDelta timestamp
;
50 struct EVENTS_OZONE_EVDEV_EXPORT MouseButtonEventParams
{
51 MouseButtonEventParams(int device_id
,
52 const gfx::PointF
& location
,
56 base::TimeDelta timestamp
);
57 MouseButtonEventParams(const MouseButtonEventParams
& other
);
58 ~MouseButtonEventParams();
65 base::TimeDelta timestamp
;
68 struct EVENTS_OZONE_EVDEV_EXPORT MouseWheelEventParams
{
69 MouseWheelEventParams(int device_id
,
70 const gfx::PointF
& location
,
71 const gfx::Vector2d
& delta
,
72 base::TimeDelta timestamp
);
73 MouseWheelEventParams(const MouseWheelEventParams
& other
);
74 ~MouseWheelEventParams();
79 base::TimeDelta timestamp
;
82 struct EVENTS_OZONE_EVDEV_EXPORT ScrollEventParams
{
83 ScrollEventParams(int device_id
,
85 const gfx::PointF location
,
86 const gfx::Vector2dF
& delta
,
87 const gfx::Vector2dF
& ordinal_delta
,
89 const base::TimeDelta timestamp
);
90 ScrollEventParams(const ScrollEventParams
& other
);
95 const gfx::PointF location
;
96 const gfx::Vector2dF delta
;
97 const gfx::Vector2dF ordinal_delta
;
99 const base::TimeDelta timestamp
;
102 struct EVENTS_OZONE_EVDEV_EXPORT TouchEventParams
{
103 TouchEventParams(int device_id
,
106 const gfx::PointF
& location
,
107 const gfx::Vector2dF
& radii
,
109 const base::TimeDelta
& timestamp
);
110 TouchEventParams(const TouchEventParams
& other
);
116 gfx::PointF location
;
117 gfx::Vector2dF radii
;
119 base::TimeDelta timestamp
;
122 // Interface used by device objects for event dispatch.
123 class EVENTS_OZONE_EVDEV_EXPORT DeviceEventDispatcherEvdev
{
125 DeviceEventDispatcherEvdev() {}
126 virtual ~DeviceEventDispatcherEvdev() {}
128 // User input events.
129 virtual void DispatchKeyEvent(const KeyEventParams
& params
) = 0;
130 virtual void DispatchMouseMoveEvent(const MouseMoveEventParams
& params
) = 0;
131 virtual void DispatchMouseButtonEvent(
132 const MouseButtonEventParams
& params
) = 0;
133 virtual void DispatchMouseWheelEvent(const MouseWheelEventParams
& params
) = 0;
134 virtual void DispatchScrollEvent(const ScrollEventParams
& params
) = 0;
135 virtual void DispatchTouchEvent(const TouchEventParams
& params
) = 0;
137 // Device lifecycle events.
138 virtual void DispatchKeyboardDevicesUpdated(
139 const std::vector
<KeyboardDevice
>& devices
) = 0;
140 virtual void DispatchTouchscreenDevicesUpdated(
141 const std::vector
<TouchscreenDevice
>& devices
) = 0;
142 virtual void DispatchMouseDevicesUpdated(
143 const std::vector
<InputDevice
>& devices
) = 0;
144 virtual void DispatchTouchpadDevicesUpdated(
145 const std::vector
<InputDevice
>& devices
) = 0;
146 virtual void DispatchDeviceListsComplete() = 0;
151 #endif // UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_