Mir
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
shared
mir_toolkit
event.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2013 Canonical Ltd.
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as 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 Voss <thomas.voss@canonical.com>
17
*/
18
19
#ifndef MIR_TOOLKIT_EVENT_H_
20
#define MIR_TOOLKIT_EVENT_H_
21
22
#include <stddef.h>
23
#include <stdint.h>
24
#include "
mir_toolkit/common.h
"
25
26
#ifdef __cplusplus
27
31
extern
"C"
{
32
#endif
33
/* TODO: To the moon. */
34
#define MIR_INPUT_EVENT_MAX_POINTER_COUNT 16
35
36
typedef
int64_t
nsecs_t
;
37
38
typedef
enum
39
{
40
mir_event_type_key
,
41
mir_event_type_motion
,
42
mir_event_type_surface
43
}
MirEventType
;
44
45
typedef
enum
{
46
mir_key_action_down
= 0,
47
mir_key_action_up
= 1,
48
mir_key_action_multiple
= 2
49
}
MirKeyAction
;
50
51
typedef
enum
{
52
mir_key_flag_woke_here
= 0x1,
53
mir_key_flag_soft_keyboard
= 0x2,
54
mir_key_flag_keep_touch_mode
= 0x4,
55
mir_key_flag_from_system
= 0x8,
56
mir_key_flag_editor_action
= 0x10,
57
mir_key_flag_canceled
= 0x20,
58
mir_key_flag_virtual_hard_key
= 0x40,
59
mir_key_flag_long_press
= 0x80,
60
mir_key_flag_canceled_long_press
= 0x100,
61
mir_key_flag_tracking
= 0x200,
62
mir_key_flag_fallback
= 0x400
63
}
MirKeyFlag
;
64
65
typedef
enum
{
66
mir_key_modifier_none
= 0,
67
mir_key_modifier_alt
= 0x02,
68
mir_key_modifier_alt_left
= 0x10,
69
mir_key_modifier_alt_right
= 0x20,
70
mir_key_modifier_shift
= 0x01,
71
mir_key_modifier_shift_left
= 0x40,
72
mir_key_modifier_shift_right
= 0x80,
73
mir_key_modifier_sym
= 0x04,
74
mir_key_modifier_function
= 0x08,
75
mir_key_modifier_ctrl
= 0x1000,
76
mir_key_modifier_ctrl_left
= 0x2000,
77
mir_key_modifier_ctrl_right
= 0x4000,
78
mir_key_modifier_meta
= 0x10000,
79
mir_key_modifier_meta_left
= 0x20000,
80
mir_key_modifier_meta_right
= 0x40000,
81
mir_key_modifier_caps_lock
= 0x100000,
82
mir_key_modifier_num_lock
= 0x200000,
83
mir_key_modifier_scroll_lock
= 0x400000
84
}
MirKeyModifier
;
85
86
typedef
enum
{
87
mir_motion_action_down
= 0,
88
mir_motion_action_up
= 1,
89
mir_motion_action_move
= 2,
90
mir_motion_action_cancel
= 3,
91
mir_motion_action_outside
= 4,
92
mir_motion_action_pointer_down
= 5,
93
mir_motion_action_pointer_up
= 6,
94
mir_motion_action_hover_move
= 7,
95
mir_motion_action_scroll
= 8,
96
mir_motion_action_hover_enter
= 9,
97
mir_motion_action_hover_exit
= 10
98
}
MirMotionAction
;
99
100
typedef
enum
{
101
mir_motion_flag_window_is_obscured
= 0x1
102
}
MirMotionFlag
;
103
104
typedef
enum
{
105
mir_motion_button_primary
= 1 << 0,
106
mir_motion_button_secondary
= 1 << 1,
107
mir_motion_button_tertiary
= 1 << 2,
108
mir_motion_button_back
= 1 << 3,
109
mir_motion_button_forward
= 1 << 4
110
}
MirMotionButton
;
111
112
typedef
struct
113
{
114
MirEventType
type
;
115
116
int32_t
device_id
;
117
int32_t
source_id
;
118
MirKeyAction
action
;
119
MirKeyFlag
flags
;
120
unsigned
int
modifiers
;
121
122
int32_t
key_code
;
123
int32_t
scan_code
;
124
int32_t
repeat_count
;
125
nsecs_t
down_time
;
126
nsecs_t
event_time
;
127
int
is_system_key
;
128
}
MirKeyEvent
;
129
130
typedef
struct
131
{
132
MirEventType
type
;
133
134
int32_t
device_id
;
135
int32_t
source_id
;
136
/*
137
* TODO(racarr): We would like to store this as a MirMotionAction but the android input stack
138
* encodes some non enumerable values in it. It's convenient to keep things
139
* this way for now until we can drop SF/Hybris support in QtUbuntu.
140
*/
141
int
action
;
142
MirMotionFlag
flags
;
143
unsigned
int
modifiers
;
144
145
int32_t
edge_flags
;
146
MirMotionButton
button_state
;
147
float
x_offset
;
148
float
y_offset
;
149
float
x_precision
;
150
float
y_precision
;
151
nsecs_t
down_time
;
152
nsecs_t
event_time
;
153
154
size_t
pointer_count
;
155
struct
156
{
157
int
id
;
158
float
x
, raw_x;
159
float
y
, raw_y;
160
float
touch_major
;
161
float
touch_minor
;
162
float
size
;
163
float
pressure
;
164
float
orientation
;
165
} pointer_coordinates[
MIR_INPUT_EVENT_MAX_POINTER_COUNT
];
166
}
MirMotionEvent
;
167
168
typedef
struct
169
{
170
MirEventType
type
;
171
172
int
id
;
173
MirSurfaceAttrib
attrib
;
174
int
value
;
175
}
MirSurfaceEvent
;
176
177
typedef
union
178
{
179
MirEventType
type
;
180
MirKeyEvent
key
;
181
MirMotionEvent
motion
;
182
MirSurfaceEvent
surface
;
183
}
MirEvent
;
184
185
#ifdef __cplusplus
186
}
188
#endif
189
190
#endif
/* MIR_TOOLKIT_EVENT_H_ */
Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Oct 15 00:23:28 UTC 2013