Mir
event_builders.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Author: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_EVENT_BUILDERS_H_
20 #define MIR_EVENT_BUILDERS_H_
21 
22 #include "mir_toolkit/event.h"
23 
24 #include "mir/geometry/size.h"
26 
27 #include <memory>
28 #include <functional>
29 #include <chrono>
30 
31 namespace mir
32 {
33  typedef std::unique_ptr<MirEvent, void(*)(MirEvent*)> EventUPtr;
34 
35 namespace events
36 {
37 // Surface orientation change event
38 EventUPtr make_event(frontend::SurfaceId const& surface_id, MirOrientation orientation);
39 // Prompt session state change event
40 EventUPtr make_event(MirPromptSessionState state);
41 // Surface resize event
42 EventUPtr make_event(frontend::SurfaceId const& surface_id, geometry::Size const& size);
43 // Surface configure event
44 EventUPtr make_event(frontend::SurfaceId const& surface_id, MirSurfaceAttrib attribute, int value);
45 // Close surface event
46 EventUPtr make_event(frontend::SurfaceId const& surface_id);
47 // Keymap event
48 EventUPtr make_event(frontend::SurfaceId const& surface_id, xkb_rule_names const& names);
49 // Surface output event
50 EventUPtr make_event(
51  frontend::SurfaceId const& surface_id,
52  int dpi,
53  float scale,
54  MirFormFactor form_factor);
55 
56 // Key event
57 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
58  uint64_t mac, MirKeyboardAction action, xkb_keysym_t key_code,
59  int scan_code, MirInputEventModifiers modifiers);
60 
61 // Deprecated version without mac
62 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
63  MirKeyboardAction action, xkb_keysym_t key_code,
64  int scan_code, MirInputEventModifiers modifiers) __attribute__ ((deprecated));
65 
66 // Touch event
67 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
68  uint64_t mac, MirInputEventModifiers modifiers);
69 
70 // Deprecated version without mac
71 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
72  MirInputEventModifiers modifiers) __attribute__ ((deprecated));
73 
74 void add_touch(MirEvent &event, MirTouchId touch_id, MirTouchAction action,
75  MirTouchTooltype tooltype, float x_axis_value, float y_axis_value,
76  float pressure_value, float touch_major_value, float touch_minor_value, float size_value);
77 
78 // Pointer event
79 // Deprecated version without relative axis
80 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
81  uint64_t mac, MirInputEventModifiers modifiers, MirPointerAction action,
82  MirPointerButtons buttons_pressed,
83  float x_axis_value, float y_axis_value,
84  float hscroll_value, float vscroll_value) __attribute__ ((deprecated));
85 
86 // Deprecated version without relative axis and mac
87 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
88  MirInputEventModifiers modifiers, MirPointerAction action,
89  MirPointerButtons buttons_pressed,
90  float x_axis_value, float y_axis_value,
91  float hscroll_value, float vscroll_value) __attribute__ ((deprecated));
92 
93 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
94  uint64_t mac, MirInputEventModifiers modifiers, MirPointerAction action,
95  MirPointerButtons buttons_pressed,
96  float x_axis_value, float y_axis_value,
97  float hscroll_value, float vscroll_value,
98  float relative_x_value, float relative_y_value);
99 
100 // Deprecated version without mac
101 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
102  MirInputEventModifiers modifiers, MirPointerAction action,
103  MirPointerButtons buttons_pressed,
104  float x_axis_value, float y_axis_value,
105  float hscroll_value, float vscroll_value,
106  float relative_x_value, float relative_y_value) __attribute__ ((deprecated));
107 
108 // Input configuration event
109 EventUPtr make_event(MirInputConfigurationAction action,
110  MirInputDeviceId id, std::chrono::nanoseconds time);
111 }
112 }
113 
114 #endif // MIR_EVENT_BUILDERS_H_
Definition: size.h:30
All things Mir.
Definition: atomic_callback.h:25
MirPromptSessionState
Definition: common.h:109
void add_touch(MirEvent &event, MirTouchId touch_id, MirTouchAction action, MirTouchTooltype tooltype, float x_axis_value, float y_axis_value, float pressure_value, float touch_major_value, float touch_minor_value, float size_value)
Definition: event_builders.cpp:200
int __attribute__((constructor)) init_google_protobuf()
Definition: google_protobuf_guard.cpp:21
int32_t MirTouchId
An identifier for a touch-point.
Definition: touch_event.h:40
MirPointerAction
Possible pointer actions.
Definition: pointer_event.h:40
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:164
MirKeyboardAction
Possible actions for changing key state.
Definition: keyboard_event.h:49
unsigned int MirInputEventModifiers
Definition: input_event.h:65
int64_t MirInputDeviceId
Definition: input_event.h:34
std::unique_ptr< MirEvent, void(*)(MirEvent *)> EventUPtr
Definition: event_builders.h:33
EventUPtr make_event(frontend::SurfaceId const &surface_id, MirOrientation orientation)
Definition: event_builders.cpp:43
MirSurfaceAttrib
Attributes of a surface that the client and server/shell may wish to get or set over the wire...
Definition: common.h:34
MirTouchTooltype
Identifiers for per-touch tool types.
Definition: touch_event.h:78
MirFormFactor
Form factor associated with a physical output.
Definition: common.h:197
unsigned int MirPointerButtons
Definition: pointer_event.h:82
MirInputConfigurationAction
MirInputConfigurationEvent indicates a configuration change in the input device subsystem. Eventually it's usage will be required to properly interpret MirInputEvent, for example: If we receive a button down, and then a device reset, we should not expect to receive the button up.
Definition: input_configuration_event.h:43
Definition: event_private.h:178
MirTouchAction
Possible per touch actions for state changing.
Definition: touch_event.h:45
int const size
Definition: make_socket_rpc_channel.cpp:51

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015