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.h"
15 #include "ui/events/event_constants.h"
16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
17 #include "ui/gfx/geometry/point_f.h"
18 #include "ui/gfx/geometry/vector2d.h"
19 #include "ui/gfx/geometry/vector2d_f.h"
23 struct EVENTS_OZONE_EVDEV_EXPORT KeyEventParams
{
24 KeyEventParams(int device_id
,
27 bool suppress_auto_repeat
,
28 base::TimeDelta timestamp
);
29 KeyEventParams(const KeyEventParams
& other
);
35 bool suppress_auto_repeat
;
36 base::TimeDelta timestamp
;
39 struct EVENTS_OZONE_EVDEV_EXPORT MouseMoveEventParams
{
40 MouseMoveEventParams(int device_id
,
41 const gfx::PointF
& location
,
42 const PointerDetails
& details
,
43 base::TimeDelta timestamp
);
44 MouseMoveEventParams(const MouseMoveEventParams
& other
);
45 ~MouseMoveEventParams();
49 PointerDetails pointer_details
;
50 base::TimeDelta timestamp
;
53 struct EVENTS_OZONE_EVDEV_EXPORT MouseButtonEventParams
{
54 MouseButtonEventParams(int device_id
,
55 const gfx::PointF
& location
,
59 const PointerDetails
& details
,
60 base::TimeDelta timestamp
);
61 MouseButtonEventParams(const MouseButtonEventParams
& other
);
62 ~MouseButtonEventParams();
69 PointerDetails pointer_details
;
70 base::TimeDelta timestamp
;
73 struct EVENTS_OZONE_EVDEV_EXPORT MouseWheelEventParams
{
74 MouseWheelEventParams(int device_id
,
75 const gfx::PointF
& location
,
76 const gfx::Vector2d
& delta
,
77 base::TimeDelta timestamp
);
78 MouseWheelEventParams(const MouseWheelEventParams
& other
);
79 ~MouseWheelEventParams();
84 base::TimeDelta timestamp
;
87 struct EVENTS_OZONE_EVDEV_EXPORT ScrollEventParams
{
88 ScrollEventParams(int device_id
,
90 const gfx::PointF location
,
91 const gfx::Vector2dF
& delta
,
92 const gfx::Vector2dF
& ordinal_delta
,
94 const base::TimeDelta timestamp
);
95 ScrollEventParams(const ScrollEventParams
& other
);
100 const gfx::PointF location
;
101 const gfx::Vector2dF delta
;
102 const gfx::Vector2dF ordinal_delta
;
104 const base::TimeDelta timestamp
;
107 struct EVENTS_OZONE_EVDEV_EXPORT TouchEventParams
{
108 TouchEventParams(int device_id
,
111 const gfx::PointF
& location
,
112 const gfx::Vector2dF
& radii
,
114 const base::TimeDelta
& timestamp
);
115 TouchEventParams(const TouchEventParams
& other
);
121 gfx::PointF location
;
122 gfx::Vector2dF radii
;
124 base::TimeDelta timestamp
;
127 // Interface used by device objects for event dispatch.
128 class EVENTS_OZONE_EVDEV_EXPORT DeviceEventDispatcherEvdev
{
130 DeviceEventDispatcherEvdev() {}
131 virtual ~DeviceEventDispatcherEvdev() {}
133 // User input events.
134 virtual void DispatchKeyEvent(const KeyEventParams
& params
) = 0;
135 virtual void DispatchMouseMoveEvent(const MouseMoveEventParams
& params
) = 0;
136 virtual void DispatchMouseButtonEvent(
137 const MouseButtonEventParams
& params
) = 0;
138 virtual void DispatchMouseWheelEvent(const MouseWheelEventParams
& params
) = 0;
139 virtual void DispatchScrollEvent(const ScrollEventParams
& params
) = 0;
140 virtual void DispatchTouchEvent(const TouchEventParams
& params
) = 0;
142 // Device lifecycle events.
143 virtual void DispatchKeyboardDevicesUpdated(
144 const std::vector
<KeyboardDevice
>& devices
) = 0;
145 virtual void DispatchTouchscreenDevicesUpdated(
146 const std::vector
<TouchscreenDevice
>& devices
) = 0;
147 virtual void DispatchMouseDevicesUpdated(
148 const std::vector
<InputDevice
>& devices
) = 0;
149 virtual void DispatchTouchpadDevicesUpdated(
150 const std::vector
<InputDevice
>& devices
) = 0;
151 virtual void DispatchDeviceListsComplete() = 0;
156 #endif // UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_