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 
149 typedef struct
150 {
152 
153  int32_t device_id;
154  int32_t source_id;
155  int32_t action;
156  int32_t flags;
157  int32_t meta_state;
158 
159  int32_t edge_flags;
160  int32_t button_state;
161  float x_offset;
162  float y_offset;
163  float x_precision;
164  float y_precision;
165  nsecs_t down_time;
166  nsecs_t event_time;
167  size_t pointer_count;
169  {
170  int id;
171  float x, raw_x;
172  float y, raw_y;
173  float touch_major;
174  float touch_minor;
175  float size;
176  float pressure;
177  float orientation;
179 } MotionEvent;
180 
181 typedef struct
182 {
184 
186  int32_t value;
187 } SurfaceEvent;
188 
190 typedef struct
191 {
193 
194  int32_t width;
195  int32_t height;
196 } ResizeEvent;
197 
198 typedef union
199 {
205 } WindowEvent;
206 
207 #ifdef __cplusplus
208 }
209 #endif
210 
211 #include "event_deprecated.h"
212 
213 #endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
int32_t width
The new surface width.
Definition: event.h:194
MotionEvent motion
Definition: event.h:202
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:151
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:167
int id
Unique id of the pointer.
Definition: event.h:170
nsecs_t event_time
Timestamp that marks when this event happened.
Definition: event.h:166
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:186
SurfaceAttributeType attribute
The surface attribute that has changed.
Definition: event.h:185
nsecs_t down_time
Timestamp that marks the down event.
Definition: event.h:165
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:161
ResizeEvent resize
Definition: event.h:204
int32_t flags
Flags associated with this event.
Definition: event.h:156
int32_t source_id
Source that this event originated from.
Definition: event.h:154
UMotionAction
Definition: event.h:79
UKeyFlag
Definition: event.h:40
int32_t height
The new surface height.
Definition: event.h:195
int32_t flags
Flags associated with this event.
Definition: event.h:134
float x_precision
Sampling precision in x direction.
Definition: event.h:163
int32_t device_id
Device that this event originated from.
Definition: event.h:153
int32_t meta_state
State of the meta modifiers (ALT, CTRL, SHIFT).
Definition: event.h:157
SurfaceEvent surface
Definition: event.h:203
nsecs_t event_time
Definition: event.h:141
UMotionFlag
Definition: event.h:93
WindowEventType type
Definition: event.h:192
SurfaceAttributeType
Definition: event.h:112
float size
Size of the pointer/touch.
Definition: event.h:175
int32_t action
Action signalled by this event.
Definition: event.h:155
float orientation
Orientation.
Definition: event.h:177
float pressure
Pressure of the touch.
Definition: event.h:176
WindowEventType type
Definition: event.h:183
WindowEventType
Definition: event.h:118
int32_t button_state
State of buttons of the device.
Definition: event.h:160
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
float touch_major
Touch major coordinate.
Definition: event.h:173
WindowEventType type
Definition: event.h:200
int32_t edge_flags
Set for touches intersecting a touchscreen's edges, requires HW support.
Definition: event.h:159
KeyEvent key
Definition: event.h:201
UMotionButtonMask
Definition: event.h:97
int64_t nsecs_t
Definition: event.h:110
float touch_minor
Touch minor coordinate.
Definition: event.h:174
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:164
float y_offset
Movement in y direction since down event.
Definition: event.h:162