Mir
toolkit_event.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2020 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 as
6  * 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: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIRAL_TOOLKIT_EVENT_H_
20 #define MIRAL_TOOLKIT_EVENT_H_
21 
23 
24 #include <xkbcommon/xkbcommon.h>
25 
26 struct MirEvent;
27 struct MirKeyboardEvent;
28 struct MirTouchEvent;
29 struct MirPointerEvent;
30 struct MirInputEvent;
31 
37 typedef int32_t MirTouchId;
38 
39 namespace miral
40 {
41 namespace toolkit
42 {
52 
61 MirInputEvent const* mir_event_get_input_event(MirEvent const* event);
62 
64 // * Retrieves the device id responsible for generating an input event.
65 // *
66 // * \param [in] event The input event
67 // * \return The id of the generating device
68 // */
69 //MirInputDeviceId mir_input_event_get_device_id(MirInputEvent const* event);
70 
77 int64_t mir_input_event_get_event_time(MirInputEvent const* event);
78 
85 MirInputEventType mir_input_event_get_type(MirInputEvent const* event);
86 
94 MirKeyboardEvent const* mir_input_event_get_keyboard_event(MirInputEvent const* event);
95 
103 MirTouchEvent const* mir_input_event_get_touch_event(MirInputEvent const* event);
104 
112 MirPointerEvent const* mir_input_event_get_pointer_event(MirInputEvent const* event);
113 
120 bool mir_input_event_has_cookie(MirInputEvent const* ev);
121 
123 // * Returns the cookie associated with an input event.
124 // *
125 // * \pre The input event must have a MirCookie
126 // * \param [in] ev An input event
127 // * \return The cookie associated with the given input event
128 // * The cookie must be released by calling mir_cookie_release
129 // */
130 //MirCookie const* mir_input_event_get_cookie(MirInputEvent const* ev);
131 
138 MirEvent const* mir_input_event_get_event(MirInputEvent const* event);
139 
146 MirKeyboardAction mir_keyboard_event_action(MirKeyboardEvent const* event);
147 
156 xkb_keysym_t mir_keyboard_event_keysym(MirKeyboardEvent const* event);
157 
161 xkb_keysym_t mir_keyboard_event_key_code(MirKeyboardEvent const* event);
162 
170 int mir_keyboard_event_scan_code(MirKeyboardEvent const* event);
171 
182 char const* mir_keyboard_event_key_text(MirKeyboardEvent const* event);
183 
191 
198 MirInputEvent const* mir_keyboard_event_input_event(MirKeyboardEvent const* event);
199 
207 
215 unsigned int mir_touch_event_point_count(MirTouchEvent const* event);
216 
224 MirTouchId mir_touch_event_id(MirTouchEvent const* event, unsigned int touch_index);
225 
233 MirTouchAction mir_touch_event_action(MirTouchEvent const* event, unsigned int touch_index);
234 
242 MirTouchTooltype mir_touch_event_tooltype(MirTouchEvent const* event, unsigned int touch_index);
243 
244 
253 float mir_touch_event_axis_value(MirTouchEvent const* event, unsigned int touch_index, MirTouchAxis axis);
254 
261 MirInputEvent const* mir_touch_event_input_event(MirTouchEvent const* event);
262 
263 
271 
278 MirPointerAction mir_pointer_event_action(MirPointerEvent const* event);
279 
288 bool mir_pointer_event_button_state(MirPointerEvent const* event,
289  MirPointerButton button);
290 
298 MirPointerButtons mir_pointer_event_buttons(MirPointerEvent const* event);
299 
307 float mir_pointer_event_axis_value(MirPointerEvent const* event,
308  MirPointerAxis axis);
309 
316 MirInputEvent const* mir_pointer_event_input_event(MirPointerEvent const* event);
317 }
318 }
319 
320 #endif //MIRAL_TOOLKIT_EVENT_H_
struct MirEvent MirEvent
Definition: append_event_filter.h:25
MirPointerAction
Possible pointer actions.
Definition: enums.h:149
unsigned int MirPointerButtons
Definition: enums.h:201
MirInputEventType
Definition: enums.h:45
MirEventType
Definition: enums.h:28
MirPointerButton
Definition: enums.h:191
MirKeyboardAction
Possible actions for changing key state.
Definition: enums.h:82
MirTouchAxis
Identifiers for touch axis.
Definition: enums.h:111
MirTouchTooltype
Identifiers for per-touch tool types.
Definition: enums.h:134
MirTouchAction
Possible per touch actions for state changing.
Definition: enums.h:97
MirPointerAxis
Identifiers for pointer axis.
Definition: enums.h:167
unsigned int MirInputEventModifiers
Definition: enums.h:77
MirPointerButtons mir_pointer_event_buttons(MirPointerEvent const *event)
Retreive the pointer button state as a masked set of values.
MirInputEvent const * mir_touch_event_input_event(MirTouchEvent const *event)
Retrieve the corresponding input event.
xkb_keysym_t mir_keyboard_event_key_code(MirKeyboardEvent const *event)
MirInputEventType mir_input_event_get_type(MirInputEvent const *event)
Retrieve the type of an input event.
MirKeyboardEvent const * mir_input_event_get_keyboard_event(MirInputEvent const *event)
Retrieve the MirKeyboardEvent associated with a given input event.
char const * mir_keyboard_event_key_text(MirKeyboardEvent const *event)
Retrieve the text the key press would emit as null terminated utf8 string.
MirInputEventModifiers mir_touch_event_modifiers(MirTouchEvent const *event)
Retrieve the modifier keys pressed when the touch action occured.
MirEvent const * mir_input_event_get_event(MirInputEvent const *event)
‍**
MirTouchAction mir_touch_event_action(MirTouchEvent const *event, unsigned int touch_index)
Retrieve the action which occured for a touch at given index.
bool mir_input_event_has_cookie(MirInputEvent const *ev)
Query if an input event contains a cookie.
int64_t mir_input_event_get_event_time(MirInputEvent const *event)
‍**
MirInputEvent const * mir_pointer_event_input_event(MirPointerEvent const *event)
Retrieve the corresponding input event.
unsigned int mir_touch_event_point_count(MirTouchEvent const *event)
Retrieve the number of touches reported for a given touch event.
MirInputEvent const * mir_keyboard_event_input_event(MirKeyboardEvent const *event)
Retrieve the corresponding input event.
MirInputEventModifiers mir_pointer_event_modifiers(MirPointerEvent const *event)
Retrieve the modifier keys pressed when the pointer action occured.
MirTouchTooltype mir_touch_event_tooltype(MirTouchEvent const *event, unsigned int touch_index)
Retrieve the tooltype for touch at given index.
MirTouchEvent const * mir_input_event_get_touch_event(MirInputEvent const *event)
Retrieve the MirTouchEvent associated with a given input event.
int mir_keyboard_event_scan_code(MirKeyboardEvent const *event)
Retrieve the raw hardware scan code associated with the key acted on.
MirKeyboardAction mir_keyboard_event_action(MirKeyboardEvent const *event)
Retrieve the action which triggered a given key event.
MirPointerEvent const * mir_input_event_get_pointer_event(MirInputEvent const *event)
Retrieve the MirPointerEvent associated with a given input event.
float mir_touch_event_axis_value(MirTouchEvent const *event, unsigned int touch_index, MirTouchAxis axis)
Retrieve the axis value for a given axis on an indexed touch.
MirInputEvent const * mir_event_get_input_event(MirEvent const *event)
Retrieve the MirInputEvent associated with a MirEvent of type mir_event_type_input.
MirPointerAction mir_pointer_event_action(MirPointerEvent const *event)
Retrieve the action which occured to generate a given pointer event.
xkb_keysym_t mir_keyboard_event_keysym(MirKeyboardEvent const *event)
Retrieve the xkb mapped keysym associated with the key acted on.
MirEventType mir_event_get_type(MirEvent const *event)
Retrieves the type of a MirEvent.
float mir_pointer_event_axis_value(MirPointerEvent const *event, MirPointerAxis axis)
Retrieve the axis value reported by a given pointer event.
MirTouchId mir_touch_event_id(MirTouchEvent const *event, unsigned int touch_index)
Retrieve the TouchID for a touch at given index.
MirInputEventModifiers mir_keyboard_event_modifiers(MirKeyboardEvent const *event)
Retrieve the modifier keys pressed when the key action occured.
bool mir_pointer_event_button_state(MirPointerEvent const *event, MirPointerButton button)
Retrieve the state of a given pointer button when the action occurred.
Mir Abstraction Layer.
Definition: floating_window_manager.h:31
int32_t MirTouchId
An identifier for a touch-point.
Definition: toolkit_event.h:30

Copyright © 2012-2022 Canonical Ltd.
Generated on Fri Feb 25 18:01:44 UTC 2022
This documentation is licensed under the GPL version 2 or 3.