Ubuntu Platform API  2.8.1
A library helping with tight integration into the Ubuntu platform
event.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012-2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 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 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: Thomas Voß <thomas.voss@canonical.com>
17  * Daniel d'Andrada <daniel.dandrada@canonical.com>
18  */
19 #ifndef UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
20 #define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
21 
22 #include <ubuntu/visibility.h>
24 
25 #include <stddef.h>
26 #include <stdint.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 // TODO<papi>: Perhaps we should update the struct to use these enum types. But then we need to move action/flags
33 // in to the internal typed event structs.
34 
35 typedef enum {
39 } UKeyAction;
40 
41 typedef enum {
53 } UKeyFlag;
54 
55 typedef enum {
75 
76 #define U_MOTION_ACTION_POINTER_INDEX_SHIFT 8
77 #define U_MOTION_ACTION_MASK 0xff
78 #define U_MOTION_ACTION_POINTER_INDEX_MASK 0xff00
79 
80 typedef enum {
93 
94 typedef enum {
96 } UMotionFlag;
97 
98 typedef enum {
105 
106 
108 #define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT (16)
109 
111 typedef int64_t nsecs_t;
112 
113 typedef enum
114 {
117 
119 typedef enum
120 {
127 
129 typedef struct
130 {
132 
133  int32_t device_id;
134  int32_t source_id;
135  int32_t action;
136  int32_t flags;
137  int32_t meta_state;
138 
139  int32_t key_code;
140  int32_t scan_code;
141  int32_t repeat_count;
142  nsecs_t down_time;
143  nsecs_t event_time;
145 } KeyEvent;
146 
148 {
149  int id;
150  float x, raw_x;
151  float y, raw_y;
152  float touch_major;
153  float touch_minor;
154  float size;
155  float pressure;
156  float orientation;
157 };
158 
163 typedef struct
164 {
166 
167  int32_t device_id;
168  int32_t source_id;
169  int32_t action;
170  int32_t flags;
171  int32_t meta_state;
172 
173  int32_t edge_flags;
174  int32_t button_state;
175  float x_offset;
176  float y_offset;
177  float x_precision;
178  float y_precision;
179  nsecs_t down_time;
180  nsecs_t event_time;
181  size_t pointer_count;
183 } MotionEvent;
184 
185 typedef struct
186 {
188 
190  int32_t value;
191 } SurfaceEvent;
192 
194 typedef struct
195 {
197 
198  int32_t width;
199  int32_t height;
200 } ResizeEvent;
201 
203 typedef struct
204 {
206 
209 
210 typedef union
211 {
218 } WindowEvent;
219 
220 #ifdef __cplusplus
221 }
222 #endif
223 
224 #include "event_deprecated.h"
225 
226 #endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
int32_t width
The new surface width.
Definition: event.h:198
MotionEvent motion
Definition: event.h:214
int32_t action
Action signalled by this event.
Definition: event.h:135
Surface has been resized.
Definition: event.h:123
int32_t key_code
Definition: event.h:139
WindowEventType type
Definition: event.h:165
UKeyModifierMask
Definition: event.h:55
#define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT
Definition: event.h:108
size_t pointer_count
Number of pointers reported in this event.
Definition: event.h:181
float size
Size of the pointer/touch.
Definition: event.h:154
nsecs_t event_time
Timestamp that marks when this event happened.
Definition: event.h:180
int32_t scan_code
Definition: event.h:140
nsecs_t down_time
Definition: event.h:142
UKeyAction
Definition: event.h:35
int32_t value
The new value of that surface attribute.
Definition: event.h:190
SurfaceAttributeType attribute
The surface attribute that has changed.
Definition: event.h:189
nsecs_t down_time
Timestamp that marks the down event.
Definition: event.h:179
Event originates from a keyboard.
Definition: event.h:121
int is_system_key
Definition: event.h:144
int32_t meta_state
State of the meta modifiers (ALT, CTRL, SHIFT).
Definition: event.h:137
WindowEventType type
Definition: event.h:205
float x_offset
Movement in x direction since down event.
Definition: event.h:175
ResizeEvent resize
Definition: event.h:216
float touch_major
Touch major coordinate.
Definition: event.h:152
OrientationEvent orientation
Definition: event.h:217
int32_t flags
Flags associated with this event.
Definition: event.h:170
float raw_y
Processed and raw y coordinates.
Definition: event.h:151
int32_t source_id
Source that this event originated from.
Definition: event.h:168
UMotionAction
Definition: event.h:80
UKeyFlag
Definition: event.h:41
int32_t height
The new surface height.
Definition: event.h:199
int32_t flags
Flags associated with this event.
Definition: event.h:136
float x_precision
Sampling precision in x direction.
Definition: event.h:177
int32_t device_id
Device that this event originated from.
Definition: event.h:167
float raw_x
Processed and raw x coordinates.
Definition: event.h:150
A surface attribute has changed its value.
Definition: event.h:124
int32_t meta_state
State of the meta modifiers (ALT, CTRL, SHIFT).
Definition: event.h:171
SurfaceEvent surface
Definition: event.h:215
nsecs_t event_time
Definition: event.h:143
UMotionFlag
Definition: event.h:94
WindowEventType type
Definition: event.h:196
SurfaceAttributeType
Definition: event.h:113
int32_t action
Action signalled by this event.
Definition: event.h:169
WindowEventType type
Definition: event.h:187
WindowEventType
Definition: event.h:119
The device orientation changed.
Definition: event.h:125
int32_t button_state
State of buttons of the device.
Definition: event.h:174
int32_t source_id
Source that this event originated from.
Definition: event.h:134
UApplicationUiWindowOrientation
int32_t device_id
Device that this event originated from.
Definition: event.h:133
int32_t repeat_count
Definition: event.h:141
WindowEventType type
Definition: event.h:131
UApplicationUiWindowOrientation direction
The new surface orientation.
Definition: event.h:207
WindowEventType type
Definition: event.h:212
int32_t edge_flags
Set for touches intersecting a touchscreen's edges, requires HW support.
Definition: event.h:173
int id
Unique id of the pointer.
Definition: event.h:149
float pressure
Pressure of the touch.
Definition: event.h:155
KeyEvent key
Definition: event.h:213
UMotionButtonMask
Definition: event.h:98
int64_t nsecs_t
Definition: event.h:111
float orientation
Orientation.
Definition: event.h:156
float touch_minor
Touch minor coordinate.
Definition: event.h:153
Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
Definition: event.h:122
float y_precision
Sampling precision in y direction.
Definition: event.h:178
float y_offset
Movement in y direction since down event.
Definition: event.h:176