2
* Copyright © 2014 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Robert Carr <robert.carr@canonical.com>
19
#ifndef MIR_TOOLKIT_EVENT_H_
20
#define MIR_TOOLKIT_EVENT_H_
24
#include "mir_toolkit/common.h"
28
* \addtogroup mir_toolkit
37
mir_event_type_motion,
38
mir_event_type_surface,
39
mir_event_type_resize,
40
mir_event_type_prompt_session_state_change,
41
mir_event_type_orientation,
42
mir_event_type_close_surface,
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 */
49
typedef struct MirSurfaceEvent MirSurfaceEvent;
50
typedef struct MirResizeEvent MirResizeEvent;
51
typedef struct MirPromptSessionEvent MirPromptSessionEvent;
52
typedef struct MirOrientationEvent MirOrientationEvent;
53
typedef struct MirCloseSurfaceEvent MirCloseSurfaceEvent;
54
typedef struct MirInputEvent MirInputEvent;
55
typedef struct MirKeymapEvent MirKeymapEvent;
57
typedef union MirEvent MirEvent;
64
#include "mir_toolkit/events/input/input_event.h"
65
#include "mir_toolkit/events/resize_event.h"
66
#include "mir_toolkit/events/surface_event.h"
67
#include "mir_toolkit/events/orientation_event.h"
68
#include "mir_toolkit/events/prompt_session_event.h"
69
#include "mir_toolkit/events/keymap_event.h"
73
* \addtogroup mir_toolkit
80
* Retrieves the type of a MirEvent. Now preferred over direct access to ev->type.
81
* In particular ev->type will never be mir_event_type_input and mir_event_get_type
82
* is the only way to ensure mir_event_get_input_event will succeed.
84
* \param [in] event The event
85
* \return The event type
87
MirEventType mir_event_get_type(MirEvent const* ev);
90
* Retrieve the MirInputEvent associated with a MirEvent of
91
* type mir_event_type_input. See <mir_toolkit/events/input/input_event.h>
94
* \param [in] event The event
95
* \return The associated MirInputEvent
97
MirInputEvent const* mir_event_get_input_event(MirEvent const* ev);
100
* Retrieve the MirSurfaceEvent associated with a MirEvent of
101
* type mir_event_type_surface. See <mir_toolkit/events/surface_event.h>
104
* \param [in] event The event
105
* \return The associated MirSurfaceEvent
107
MirSurfaceEvent const* mir_event_get_surface_event(MirEvent const* ev);
110
* Retrieve the MirResizeEvent associated with a MirEvent of
111
* type mir_event_type_resize. See <mir_toolkits/events/resize_event.h>
114
* \param [in] event The event
115
* \return The associated MirResizeEvent
117
MirResizeEvent const* mir_event_get_resize_event(MirEvent const* ev);
120
* Retrieve the MirPromptSessionEvent associated with a MirEvent of
121
* type mir_event_type_prompt_session_state_change. See <mir_toolkits/events/prompt_session_event.h>
124
* \param [in] event The event
125
* \return The associated MirPromptSessionEvent
127
MirPromptSessionEvent const* mir_event_get_prompt_session_event(MirEvent const* ev);
130
* Retrieve the MirOrientationEvent associated with a MirEvent of
131
* type mir_event_type_orientation. See <mir_toolkit/events/orientation_event.h>
134
* \param [in] event The event
135
* \return The associated MirOrientationEvent
137
MirOrientationEvent const* mir_event_get_orientation_event(MirEvent const* ev);
140
* Retrieve the MirCloseSurfaceEvent associated with a MirEvent of
141
* type mir_event_type_close_surface. The event is a request to close
142
* the surface it is delivered to and has no accessors.
144
* \param [in] event The event
145
* \return The associated MirCloseSurfaceEvent
147
MirCloseSurfaceEvent const* mir_event_get_close_surface_event(MirEvent const* ev);
150
* Retrieve the MirKeymapEvent associated with a MirEvent of
151
* type mir_event_type_keymap. The event signifies that the keymap
152
* applied for the relevant surface has changed.
154
* \param [in] event The event
155
* \return The associated MirKeymapEvent
157
MirKeymapEvent const* mir_event_get_keymap_event(MirEvent const* ev);
161
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
162
* _________________________
163
*< Don't use mir_event_ref >
164
*-------------------------
170
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
171
* NOTICE: mir_event_ref and mir_event_unref are implemented in terms of copy until
172
* such point whereas direct MirEvent access as deprecated. This means you must
173
* use the return value as your new reference
178
* Reference this MirEvent and return a pointer to the
179
* newly referenced instance
181
* \param[in] The event to reference
182
* \return The event pointer to now use
184
MirEvent const* mir_event_ref(MirEvent const* ev) __attribute__((warn_unused_result));
187
* Release a reference to a MirEvent.
189
* \param[in] The event to un-reference
191
void mir_event_unref(MirEvent const* ev);
198
#endif /* MIR_TOOLKIT_EVENT_H_ */