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 base::TimeDelta timestamp
);
27 KeyEventParams(const KeyEventParams
& other
);
33 base::TimeDelta timestamp
;
36 struct EVENTS_OZONE_EVDEV_EXPORT MouseMoveEventParams
{
37 MouseMoveEventParams(int device_id
,
38 const gfx::PointF
& location
,
39 base::TimeDelta timestamp
);
40 MouseMoveEventParams(const MouseMoveEventParams
& other
);
41 ~MouseMoveEventParams();
45 base::TimeDelta timestamp
;
48 struct EVENTS_OZONE_EVDEV_EXPORT MouseButtonEventParams
{
49 MouseButtonEventParams(int device_id
,
50 const gfx::PointF
& location
,
54 base::TimeDelta timestamp
);
55 MouseButtonEventParams(const MouseButtonEventParams
& other
);
56 ~MouseButtonEventParams();
63 base::TimeDelta timestamp
;
66 struct EVENTS_OZONE_EVDEV_EXPORT MouseWheelEventParams
{
67 MouseWheelEventParams(int device_id
,
68 const gfx::PointF
& location
,
69 const gfx::Vector2d
& delta
,
70 base::TimeDelta timestamp
);
71 MouseWheelEventParams(const MouseWheelEventParams
& other
);
72 ~MouseWheelEventParams();
77 base::TimeDelta timestamp
;
80 struct EVENTS_OZONE_EVDEV_EXPORT ScrollEventParams
{
81 ScrollEventParams(int device_id
,
83 const gfx::PointF location
,
84 const gfx::Vector2dF delta
,
85 const gfx::Vector2dF ordinal_delta
,
87 const base::TimeDelta timestamp
);
88 ScrollEventParams(const ScrollEventParams
& other
);
93 const gfx::PointF location
;
94 const gfx::Vector2dF delta
;
95 const gfx::Vector2dF ordinal_delta
;
97 const base::TimeDelta timestamp
;
100 struct EVENTS_OZONE_EVDEV_EXPORT TouchEventParams
{
101 TouchEventParams(int device_id
,
104 const gfx::PointF
& location
,
105 const gfx::Vector2dF
& radii
,
107 const base::TimeDelta
& timestamp
);
108 TouchEventParams(const TouchEventParams
& other
);
114 gfx::PointF location
;
115 gfx::Vector2dF radii
;
117 base::TimeDelta timestamp
;
120 // Interface used by device objects for event dispatch.
121 class EVENTS_OZONE_EVDEV_EXPORT DeviceEventDispatcherEvdev
{
123 DeviceEventDispatcherEvdev() {}
124 virtual ~DeviceEventDispatcherEvdev() {}
126 // User input events.
127 virtual void DispatchKeyEvent(const KeyEventParams
& params
) = 0;
128 virtual void DispatchMouseMoveEvent(const MouseMoveEventParams
& params
) = 0;
129 virtual void DispatchMouseButtonEvent(
130 const MouseButtonEventParams
& params
) = 0;
131 virtual void DispatchMouseWheelEvent(const MouseWheelEventParams
& params
) = 0;
132 virtual void DispatchScrollEvent(const ScrollEventParams
& params
) = 0;
133 virtual void DispatchTouchEvent(const TouchEventParams
& params
) = 0;
135 // Device lifecycle events.
136 virtual void DispatchKeyboardDevicesUpdated(
137 const std::vector
<KeyboardDevice
>& devices
) = 0;
138 virtual void DispatchTouchscreenDevicesUpdated(
139 const std::vector
<TouchscreenDevice
>& devices
) = 0;
140 virtual void DispatchMouseDevicesUpdated(
141 const std::vector
<InputDevice
>& devices
) = 0;
142 virtual void DispatchTouchpadDevicesUpdated(
143 const std::vector
<InputDevice
>& devices
) = 0;
148 #endif // UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_