Mir
event_factory.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 or 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_TEST_EVENT_FACTORY_H
20 #define MIR_TEST_EVENT_FACTORY_H
21 
22 #include "mir/geometry/point.h"
23 
24 #include <experimental/optional>
25 #include <chrono>
26 
27 namespace mir
28 {
29 namespace input
30 {
31 namespace synthesis
32 {
33 
34 enum class EventAction
35 {
36  Down, Up
37 };
38 
40 {
41 public:
42  KeyParameters();
43 
47 
48  int device_id;
49  int scancode;
51 };
54 
56 {
57 public:
60  ButtonParameters& of_button(int scancode);
62 
63  int device_id;
64  int button;
66 };
69 
71 {
72 public:
76  MotionParameters& with_event_time(std::chrono::nanoseconds time);
77 
78  int device_id;
79  int rel_x;
80  int rel_y;
81  std::experimental::optional<std::chrono::nanoseconds> event_time;
82 };
84 
86 {
87 public:
88  enum class Action
89  {
90  Tap = 0,
91  Move,
92  Release
93  };
94 
98  TouchParameters& with_action(Action touch_action);
99 
101  int abs_x;
102  int abs_y;
104 };
106 
107 }
108 }
109 }
110 
111 #endif /* MIR_TEST_EVENT_FACTORY_H */
KeyParameters a_key_down_event()
ButtonParameters & of_button(int scancode)
int abs_y
Definition: event_factory.h:102
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: blob.h:26
Action
Definition: event_factory.h:88
MotionParameters a_pointer_event()
Definition: event_factory.h:39
int device_id
Definition: event_factory.h:78
ButtonParameters a_button_up_event()
int button
Definition: event_factory.h:64
Definition: point.h:30
ButtonParameters a_button_down_event()
int rel_x
Definition: event_factory.h:79
KeyParameters & with_action(EventAction action)
TouchParameters a_touch_event()
MotionParameters & with_event_time(std::chrono::nanoseconds time)
KeyParameters a_key_up_event()
Action action
Definition: event_factory.h:103
Definition: event_factory.h:55
Definition: event_factory.h:70
ButtonParameters & from_device(int device_id)
std::experimental::optional< std::chrono::nanoseconds > event_time
Definition: event_factory.h:81
TouchParameters & with_action(Action touch_action)
int device_id
Definition: event_factory.h:63
KeyParameters & from_device(int device_id)
Definition: event_factory.h:85
MotionParameters & from_device(int device_id)
int device_id
Definition: event_factory.h:100
KeyParameters & of_scancode(int scancode)
ButtonParameters & with_action(EventAction action)
int abs_x
Definition: event_factory.h:101
EventAction action
Definition: event_factory.h:50
EventAction action
Definition: event_factory.h:65
int scancode
Definition: event_factory.h:49
MotionParameters & with_movement(int rel_x, int rel_y)
TouchParameters & from_device(int device_id)
int rel_y
Definition: event_factory.h:80
EventAction
Definition: event_factory.h:34
int device_id
Definition: event_factory.h:48
TouchParameters & at_position(geometry::Point abs_pos)

Copyright © 2012-2018 Canonical Ltd.
Generated on Thu Mar 15 13:04:52 UTC 2018