Mir
event.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 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  * Authored by: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_TOOLKIT_EVENT_H_
20 #define MIR_TOOLKIT_EVENT_H_
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 #include "mir_toolkit/common.h"
25 
26 #ifdef __cplusplus
27 
31 extern "C" {
32 #endif
33 
34 typedef enum
35 {
43  /* Type for new style input event will be returned from mir_event_get_type
44  when old style event type was mir_event_type_key or mir_event_type_motion */
46 } MirEventType;
47 
54 
55 typedef union MirEvent MirEvent;
56 
57 #ifdef __cplusplus
58 }
60 #endif
61 
62 #ifdef MIR_REQUIRE_DEPRECATED_EVENT_OPT_IN
63  #ifdef MIR_INCLUDE_DEPRECATED_EVENT_HEADER
65  #endif // MIR_INCLUDE_DEPRECATED_EVENT_HEADER
66 #else
68 #endif // MIR_REQUIRE_DEPRECATED_EVENT_OPT_IN
69 
70 
76 
77 #ifdef __cplusplus
78 
82 extern "C" {
83 #endif
84 
85 /*
86  * Retrieves the type of a MirEvent. Now preferred over direct access to ev->type.
87  * In particular ev->type will never be mir_event_type_input and mir_event_get_type
88  * is the only way to ensure mir_event_get_input_event will succeed.
89  *
90  * \param [in] event The event
91  * \return The event type
92  */
94 
95 /*
96  * Retrieve the MirInputEvent associated with a MirEvent of
97  * type mir_event_type_input. See <mir_toolkit/events/input/input_event.h>
98  * for accessors.
99  *
100  * \param [in] event The event
101  * \return The associated MirInputEvent
102  */
104 
105 /*
106  * Retrieve the MirSurfaceEvent associated with a MirEvent of
107  * type mir_event_type_surface. See <mir_toolkit/events/surface_event.h>
108  * for accessors.
109  *
110  * \param [in] event The event
111  * \return The associated MirSurfaceEvent
112  */
114 
115 /*
116  * Retrieve the MirResizeEvent associated with a MirEvent of
117  * type mir_event_type_resize. See <mir_toolkits/events/resize_event.h>
118  * for accessors.
119  *
120  * \param [in] event The event
121  * \return The associated MirResizeEvent
122  */
124 
125 /*
126  * Retrieve the MirPromptSessionEvent associated with a MirEvent of
127  * type mir_event_type_prompt_session_state_change. See <mir_toolkits/events/prompt_session_event.h>
128  * for accessors.
129  *
130  * \param [in] event The event
131  * \return The associated MirPromptSessionEvent
132  */
134 
135 /*
136  * Retrieve the MirOrientationEvent associated with a MirEvent of
137  * type mir_event_type_orientation. See <mir_toolkit/events/orientation_event.h>
138  * for accessors.
139  *
140  * \param [in] event The event
141  * \return The associated MirOrientationEvent
142  */
144 
145 /*
146  * Retrieve the MirCloseSurfaceEvent associated with a MirEvent of
147  * type mir_event_type_close_surface. The event is a request to close
148  * the surface it is delivered to and has no accessors.
149  *
150  * \param [in] event The event
151  * \return The associated MirCloseSurfaceEvent
152  */
154 
155 /*
156  *
157  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
158  * _________________________
159  *< Don't use mir_event_ref >
160  *-------------------------
161  * \ ^__^
162  * \ (oo)\_______
163 * (__)\ )\/\
164  * ||----w |
165  * || ||
166  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
167  * NOTICE: mir_event_ref and mir_event_unref are implemented in terms of copy until
168  * such point whereas direct MirEvent access as deprecated. This means you must
169  * use the return value as your new reference
170  *
171  */
172 
173 /*
174  * Reference this MirEvent and return a pointer to the
175  * newly referenced instance
176  *
177  * \param[in] The event to reference
178  * \return The event pointer to now use
179  */
180 MirEvent const* mir_event_ref(MirEvent const* ev) __attribute__((warn_unused_result));
181 
182 /*
183  * Release a reference to a MirEvent.
184  *
185  * \param[in] The event to un-reference
186  */
187 void mir_event_unref(MirEvent const* ev);
188 
189 #ifdef __cplusplus
190 }
192 #endif
193 
194 #endif /* MIR_TOOLKIT_EVENT_H_ */
Definition: event.h:39
Definition: event.h:36
Definition: event.h:37
MirCloseSurfaceEvent const * mir_event_get_close_surface_event(MirEvent const *ev)
Definition: event.cpp:129
Definition: event_deprecated.h:197
MirOrientationEvent const * mir_event_get_orientation_event(MirEvent const *ev)
Definition: event.cpp:122
Definition: event.h:41
Definition: event_deprecated.h:215
MirSurfaceEvent const * mir_event_get_surface_event(MirEvent const *ev)
Definition: event.cpp:101
MirPromptSessionEvent const * mir_event_get_prompt_session_event(MirEvent const *ev)
Definition: event.cpp:115
Definition: event.h:45
MirEventType
Definition: event.h:34
MirInputEvent const * mir_event_get_input_event(MirEvent const *ev)
Definition: event.cpp:89
MirEvent const * mir_event_ref(MirEvent const *ev) __attribute__((warn_unused_result))
Definition: event.cpp:185
Definition: event.h:38
Definition: event_deprecated.h:206
Definition: event_deprecated.h:230
struct MirInputEvent MirInputEvent
Definition: event.h:53
void mir_event_unref(MirEvent const *ev)
Definition: event.cpp:192
MirEventType mir_event_get_type(MirEvent const *ev)
Definition: event.cpp:77
Definition: event_deprecated.h:237
__attribute__((__deprecated__("Use mir_connection_create_display_config()"))) void mir_connection_get_display_info(MirConnection *connection
Definition: event.h:42
MirResizeEvent const * mir_event_get_resize_event(MirEvent const *ev)
Definition: event.cpp:108
Definition: event_deprecated.h:222

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Mar 24 16:15:19 UTC 2015