Ubuntu Platform API  2.2.0
A library helping with tight integration into the Ubuntu platform
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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>
23 
24 #include <stddef.h>
25 #include <stdint.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 // TODO<papi>: Perhaps we should update the struct to use these enum types. But then we need to move action/flags
32 // in to the internal typed event structs.
33 
34 typedef enum {
38 } UKeyAction;
39 
40 typedef enum {
52 } UKeyFlag;
53 
54 typedef enum {
74 
75 #define U_MOTION_ACTION_POINTER_INDEX_SHIFT 8
76 #define U_MOTION_ACTION_MASK 0xff
77 #define U_MOTION_ACTION_POINTER_INDEX_MASK 0xff00
78 
79 typedef enum {
92 
93 typedef enum {
95 } UMotionFlag;
96 
97 typedef enum {
104 
105 
107 #define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT (16)
108 
110 typedef int64_t nsecs_t;
111 
112 typedef enum
113 {
116 
118 typedef enum
119 {
123  SURFACE_WEVENT_TYPE //< A surface attribute has changed its value
125 
127 typedef struct
128 {
130 
131  int32_t device_id;
132  int32_t source_id;
133  int32_t action;
134  int32_t flags;
135  int32_t meta_state;
136 
137  int32_t key_code;
138  int32_t scan_code;
139  int32_t repeat_count;
140  nsecs_t down_time;
141  nsecs_t event_time;
143 } KeyEvent;
144 
146 {
147  int id;
148  float x, raw_x;
149  float y, raw_y;
150  float touch_major;
151  float touch_minor;
152  float size;
153  float pressure;
154  float orientation;
155 };
156 
161 typedef struct
162 {
164 
165  int32_t device_id;
166  int32_t source_id;
167  int32_t action;
168  int32_t flags;
169  int32_t meta_state;
170 
171  int32_t edge_flags;
172  int32_t button_state;
173  float x_offset;
174  float y_offset;
175  float x_precision;
176  float y_precision;
177  nsecs_t down_time;
178  nsecs_t event_time;
179  size_t pointer_count;
181 } MotionEvent;
182 
183 typedef struct
184 {
186 
188  int32_t value;
189 } SurfaceEvent;
190 
192 typedef struct
193 {
195 
196  int32_t width;
197  int32_t height;
198 } ResizeEvent;
199 
200 typedef union
201 {
207 } WindowEvent;
208 
209 #ifdef __cplusplus
210 }
211 #endif
212 
213 #include "event_deprecated.h"
214 
215 #endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
int32_t width
The new surface width.
Definition: event.h:196
MotionEvent motion
Definition: event.h:204
int32_t action
Action signalled by this event.
Definition: event.h:133
Surface has been resized.
Definition: event.h:122
int32_t key_code
Definition: event.h:137
WindowEventType type
Definition: event.h:163
UKeyModifierMask
Definition: event.h:54
#define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT
Definition: event.h:107
size_t pointer_count
Number of pointers reported in this event.
Definition: event.h:179
float size
Size of the pointer/touch.
Definition: event.h:152
nsecs_t event_time
Timestamp that marks when this event happened.
Definition: event.h:178
int32_t scan_code
Definition: event.h:138
nsecs_t down_time
Definition: event.h:140
UKeyAction
Definition: event.h:34
int32_t value
The new value of that surface attribute.
Definition: event.h:188
SurfaceAttributeType attribute
The surface attribute that has changed.
Definition: event.h:187
nsecs_t down_time
Timestamp that marks the down event.
Definition: event.h:177
Event originates from a keyboard.
Definition: event.h:120
int is_system_key
Definition: event.h:142
int32_t meta_state
State of the meta modifiers (ALT, CTRL, SHIFT).
Definition: event.h:135
float x_offset
Movement in x direction since down event.
Definition: event.h:173
ResizeEvent resize
Definition: event.h:206
float touch_major
Touch major coordinate.
Definition: event.h:150
int32_t flags
Flags associated with this event.
Definition: event.h:168
float raw_y
Processed and raw y coordinates.
Definition: event.h:149
int32_t source_id
Source that this event originated from.
Definition: event.h:166
UMotionAction
Definition: event.h:79
UKeyFlag
Definition: event.h:40
int32_t height
The new surface height.
Definition: event.h:197
int32_t flags
Flags associated with this event.
Definition: event.h:134
float x_precision
Sampling precision in x direction.
Definition: event.h:175
int32_t device_id
Device that this event originated from.
Definition: event.h:165
float raw_x
Processed and raw x coordinates.
Definition: event.h:148
int32_t meta_state
State of the meta modifiers (ALT, CTRL, SHIFT).
Definition: event.h:169
SurfaceEvent surface
Definition: event.h:205
nsecs_t event_time
Definition: event.h:141
UMotionFlag
Definition: event.h:93
WindowEventType type
Definition: event.h:194
SurfaceAttributeType
Definition: event.h:112
int32_t action
Action signalled by this event.
Definition: event.h:167
WindowEventType type
Definition: event.h:185
WindowEventType
Definition: event.h:118
int32_t button_state
State of buttons of the device.
Definition: event.h:172
int32_t source_id
Source that this event originated from.
Definition: event.h:132
int32_t device_id
Device that this event originated from.
Definition: event.h:131
int32_t repeat_count
Definition: event.h:139
WindowEventType type
Definition: event.h:129
WindowEventType type
Definition: event.h:202
int32_t edge_flags
Set for touches intersecting a touchscreen's edges, requires HW support.
Definition: event.h:171
int id
Unique id of the pointer.
Definition: event.h:147
float pressure
Pressure of the touch.
Definition: event.h:153
KeyEvent key
Definition: event.h:203
UMotionButtonMask
Definition: event.h:97
int64_t nsecs_t
Definition: event.h:110
float orientation
Orientation.
Definition: event.h:154
float touch_minor
Touch minor coordinate.
Definition: event.h:151
Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
Definition: event.h:121
float y_precision
Sampling precision in y direction.
Definition: event.h:176
float y_offset
Movement in y direction since down event.
Definition: event.h:174