Ubuntu Platform API
1.0.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 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
*/
18
#ifndef UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
19
#define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
20
21
#include <
ubuntu/visibility.h
>
22
23
#include <stddef.h>
24
#include <stdint.h>
25
26
#ifdef __cplusplus
27
extern
"C"
{
28
#endif
29
30
// TODO<papi>: Perhaps we should update the struct to use these enum types. But then we need to move action/flags
31
// in to the internal typed event structs.
32
33
typedef
enum
{
34
U_KEY_ACTION_DOWN
= 0,
35
U_KEY_ACTION_UP
= 1,
36
U_KEY_ACTION_MULTIPLE
= 2
37
}
UKeyAction
;
38
39
typedef
enum
{
40
U_KEY_FLAG_WOKE_HERE
= 0x1,
41
U_KEY_FLAG_SOFT_KEYBOARD
= 0x2,
42
U_KEY_FLAG_KEEP_TOUCH_MODE
= 0x4,
43
U_KEY_FLAG_FROM_SYSTEM
= 0x8,
44
U_KEY_FLAG_EDITOR_ACTION
= 0x10,
45
U_KEY_FLAG_CANCELED
= 0x20,
46
U_KEY_FLAG_VIRTUAL_HARD_KEY
= 0x40,
47
U_KEY_FLAG_LONG_PRESS
= 0x80,
48
U_KEY_FLAG_CANCELED_LONG_PRESS
= 0x100,
49
U_KEY_FLAG_TRACKING
= 0x200,
50
U_KEY_FLAG_FALLBACK
= 0x400
51
}
UKeyFlag
;
52
53
typedef
enum
{
54
U_KEY_MODIFIER_NONE
= 0,
55
U_KEY_MODIFIER_ALT
= 0x02,
56
U_KEY_MODIFIER_ALT_LEFT
= 0x10,
57
U_KEY_MODIFIER_ALT_RIGHT
= 0x20,
58
U_KEY_MODIFIER_SHIFT
= 0x01,
59
U_KEY_MODIFIER_SHIFT_LEFT
= 0x40,
60
U_KEY_MODIFIER_SHIFT_RIGHT
= 0x80,
61
U_KEY_MODIFIER_SYM
= 0x04,
62
U_KEY_MODIFIER_FUNCTION
= 0x08,
63
U_KEY_MODIFIER_CTRL
= 0x1000,
64
U_KEY_MODIFIER_CTRL_LEFT
= 0x2000,
65
U_KEY_MODIFIER_CTRL_RIGHT
= 0x4000,
66
U_KEY_MODIFIER_META
= 0x10000,
67
U_KEY_MODIFIER_META_LEFT
= 0x20000,
68
U_KEY_MODIFIER_META_RIGHT
= 0x40000,
69
U_KEY_MODIFIER_CAPS_LOCK
= 0x100000,
70
U_KEY_MODIFIER_NUM_LOCK
= 0x200000,
71
U_KEY_MODIFIER_SCROLL_LOCK
= 0x400000
72
}
UKeyModifierMask
;
73
74
#define U_MOTION_ACTION_POINTER_INDEX_SHIFT 8
75
#define U_MOTION_ACTION_MASK 0xff
76
#define U_MOTION_ACTION_POINTER_INDEX_MASK 0xff00
77
78
typedef
enum
{
79
U_MOTION_ACTION_DOWN
= 0,
80
U_MOTION_ACTION_UP
= 1,
81
U_MOTION_ACTION_MOVE
= 2,
82
U_MOTION_ACTION_CANCEL
= 3,
83
U_MOTION_ACTION_OUTSIDE
= 4,
84
U_MOTION_ACTION_POINTER_DOWN
= 5,
85
U_MOTION_ACTION_POINTER_UP
= 6,
86
U_MOTION_ACTION_HOVER_MOVE
= 7,
87
U_MOTION_ACTION_SCROLL
= 8,
88
U_MOTION_ACTION_HOVER_ENTER
= 9,
89
U_MOTION_ACTION_HOVER_EXIT
= 10
90
}
UMotionAction
;
91
92
typedef
enum
{
93
U_MOTION_FLAG_WINDOW_IS_OBSCURED
= 0x1
94
}
UMotionFlag
;
95
96
typedef
enum
{
97
U_MOTION_BUTTON_PRIMARY
= 1 << 0,
98
U_MOTION_BUTTON_SECONDARY
= 1 << 1,
99
U_MOTION_BUTTON_TERTIARY
= 1 << 2,
100
U_MOTION_BUTTON_BACK
= 1 << 3,
101
U_MOTION_BUTTON_FORWARD
= 1 << 4
102
}
UMotionButtonMask
;
103
104
106
#define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT (16)
107
109
typedef
int64_t
nsecs_t
;
110
112
typedef
enum
113
{
114
KEY_EVENT_TYPE
,
115
MOTION_EVENT_TYPE
,
116
HW_SWITCH_EVENT_TYPE
117
}
EventType
;
118
120
typedef
struct
121
{
122
EventType
type
;
123
int32_t
device_id
;
124
int32_t
source_id
;
125
int32_t
action
;
126
int32_t
flags
;
127
int32_t
meta_state
;
128
129
union
130
{
132
struct
HardwareSwitchEvent
133
{
134
nsecs_t
event_time
;
135
uint32_t
policy_flags
;
136
int32_t
switch_code
;
137
int32_t
switch_value
;
138
} hw_switch;
140
struct
KeyEvent
141
{
142
int32_t
key_code
;
143
int32_t
scan_code
;
144
int32_t
repeat_count
;
145
nsecs_t
down_time
;
146
nsecs_t event_time;
147
int
is_system_key
;
148
} key;
153
struct
MotionEvent
154
{
155
int32_t
edge_flags
;
156
int32_t
button_state
;
157
float
x_offset
;
158
float
y_offset
;
159
float
x_precision
;
160
float
y_precision
;
161
nsecs_t down_time;
162
nsecs_t event_time;
163
size_t
pointer_count
;
164
struct
PointerCoordinate
165
{
166
int
id
;
167
float
x
, raw_x;
168
float
y
, raw_y;
169
float
touch_major
;
170
float
touch_minor
;
171
float
size
;
172
float
pressure
;
173
float
orientation
;
174
} pointer_coordinates[
UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT
];
175
} motion;
176
} details;
177
}
Event
;
178
179
#ifdef __cplusplus
180
}
181
#endif
182
183
#endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
include
ubuntu
application
ui
input
event.h
Generated on Tue Oct 15 2013 02:50:25 for Ubuntu Platform API by
1.8.4