1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
|
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/windowmanager/wm_event_types.h
* \ingroup wm
*/
/*
* These define have its origin at sgi, where all device defines were written down in device.h.
* Blender copied the conventions quite some, and expanded it with internal new defines (ton)
*
*/
#ifndef __WM_EVENT_TYPES_H__
#define __WM_EVENT_TYPES_H__
/* customdata type */
#define EVT_DATA_GESTURE 1
#define EVT_DATA_TIMER 2
#define EVT_DATA_LISTBASE 3
#define EVT_DATA_NDOF_MOTION 4
/* tablet active, matches GHOST_TTabletMode */
#define EVT_TABLET_NONE 0
#define EVT_TABLET_STYLUS 1
#define EVT_TABLET_ERASER 2
#define MOUSEX 4
#define MOUSEY 5
/* *** wmEvent.type *** */
/* non-event, for example disabled timer */
#define EVENT_NONE 0
/* MOUSE : 0x00x */
#define LEFTMOUSE 1
#define MIDDLEMOUSE 2
#define RIGHTMOUSE 3
#define MOUSEMOVE 4
/* only use if you want user option switch possible */
#define ACTIONMOUSE 5
#define SELECTMOUSE 6
/* Extra mouse buttons */
#define BUTTON4MOUSE 7
#define BUTTON5MOUSE 8
/* More mouse buttons - can't use 9 and 10 here (wheel) */
#define BUTTON6MOUSE 18
#define BUTTON7MOUSE 19
/* Extra trackpad gestures */
#define MOUSEPAN 14
#define MOUSEZOOM 15
#define MOUSEROTATE 16
/* defaults from ghost */
#define WHEELUPMOUSE 10
#define WHEELDOWNMOUSE 11
/* mapped with userdef */
#define WHEELINMOUSE 12
#define WHEELOUTMOUSE 13
#define INBETWEEN_MOUSEMOVE 17
/* NDOF (from SpaceNavigator & friends)
* These should be kept in sync with GHOST_NDOFManager.h
* Ordering matters, exact values do not. */
#define NDOF_MOTION 400
enum {
// used internally, never sent
NDOF_BUTTON_NONE = NDOF_MOTION,
// these two are available from any 3Dconnexion device
NDOF_BUTTON_MENU,
NDOF_BUTTON_FIT,
// standard views
NDOF_BUTTON_TOP,
NDOF_BUTTON_BOTTOM,
NDOF_BUTTON_LEFT,
NDOF_BUTTON_RIGHT,
NDOF_BUTTON_FRONT,
NDOF_BUTTON_BACK,
// more views
NDOF_BUTTON_ISO1,
NDOF_BUTTON_ISO2,
// 90 degree rotations
NDOF_BUTTON_ROLL_CW,
NDOF_BUTTON_ROLL_CCW,
NDOF_BUTTON_SPIN_CW,
NDOF_BUTTON_SPIN_CCW,
NDOF_BUTTON_TILT_CW,
NDOF_BUTTON_TILT_CCW,
// device control
NDOF_BUTTON_ROTATE,
NDOF_BUTTON_PANZOOM,
NDOF_BUTTON_DOMINANT,
NDOF_BUTTON_PLUS,
NDOF_BUTTON_MINUS,
// keyboard emulation
NDOF_BUTTON_ESC,
NDOF_BUTTON_ALT,
NDOF_BUTTON_SHIFT,
NDOF_BUTTON_CTRL,
// general-purpose buttons
NDOF_BUTTON_1,
NDOF_BUTTON_2,
NDOF_BUTTON_3,
NDOF_BUTTON_4,
NDOF_BUTTON_5,
NDOF_BUTTON_6,
NDOF_BUTTON_7,
NDOF_BUTTON_8,
NDOF_BUTTON_9,
NDOF_BUTTON_10,
// more general-purpose buttons
NDOF_BUTTON_A,
NDOF_BUTTON_B,
NDOF_BUTTON_C,
// the end
NDOF_LAST
};
/* SYSTEM : 0x01xx */
#define INPUTCHANGE 0x0103 /* input connected or disconnected */
#define WINDEACTIVATE 0x0104 /* window is deactivated, focus lost */
#define TIMER 0x0110 /* timer event, passed on to all queues */
#define TIMER0 0x0111 /* timer event, slot for internal use */
#define TIMER1 0x0112 /* timer event, slot for internal use */
#define TIMER2 0x0113 /* timer event, slot for internal use */
#define TIMERJOBS 0x0114 /* timer event, jobs system */
#define TIMERAUTOSAVE 0x0115 /* timer event, autosave */
#define TIMERREPORT 0x0116 /* timer event, reports */
#define TIMERREGION 0x0117 /* timer event, region slide in/out */
#define TIMERF 0x011F /* last timer */
/* test whether the event is timer event */
#define ISTIMER(event_type) (event_type >= TIMER && event_type <= TIMERF)
/* standard keyboard */
#define AKEY 'a'
#define BKEY 'b'
#define CKEY 'c'
#define DKEY 'd'
#define EKEY 'e'
#define FKEY 'f'
#define GKEY 'g'
#define HKEY 'h'
#define IKEY 'i'
#define JKEY 'j'
#define KKEY 'k'
#define LKEY 'l'
#define MKEY 'm'
#define NKEY 'n'
#define OKEY 'o'
#define PKEY 'p'
#define QKEY 'q'
#define RKEY 'r'
#define SKEY 's'
#define TKEY 't'
#define UKEY 'u'
#define VKEY 'v'
#define WKEY 'w'
#define XKEY 'x'
#define YKEY 'y'
#define ZKEY 'z'
#define ZEROKEY '0'
#define ONEKEY '1'
#define TWOKEY '2'
#define THREEKEY '3'
#define FOURKEY '4'
#define FIVEKEY '5'
#define SIXKEY '6'
#define SEVENKEY '7'
#define EIGHTKEY '8'
#define NINEKEY '9'
#define CAPSLOCKKEY 211
#define LEFTCTRLKEY 212
#define LEFTALTKEY 213
#define RIGHTALTKEY 214
#define RIGHTCTRLKEY 215
#define RIGHTSHIFTKEY 216
#define LEFTSHIFTKEY 217
#define ESCKEY 218
#define TABKEY 219
#define RETKEY 220
#define SPACEKEY 221
#define LINEFEEDKEY 222
#define BACKSPACEKEY 223
#define DELKEY 224
#define SEMICOLONKEY 225
#define PERIODKEY 226
#define COMMAKEY 227
#define QUOTEKEY 228
#define ACCENTGRAVEKEY 229
#define MINUSKEY 230
#define SLASHKEY 232
#define BACKSLASHKEY 233
#define EQUALKEY 234
#define LEFTBRACKETKEY 235
#define RIGHTBRACKETKEY 236
#define LEFTARROWKEY 137
#define DOWNARROWKEY 138
#define RIGHTARROWKEY 139
#define UPARROWKEY 140
#define PAD0 150
#define PAD1 151
#define PAD2 152
#define PAD3 153
#define PAD4 154
#define PAD5 155
#define PAD6 156
#define PAD7 157
#define PAD8 158
#define PAD9 159
#define PADPERIOD 199
#define PADSLASHKEY 161
#define PADASTERKEY 160
#define PADMINUS 162
#define PADENTER 163
#define PADPLUSKEY 164
#define F1KEY 300
#define F2KEY 301
#define F3KEY 302
#define F4KEY 303
#define F5KEY 304
#define F6KEY 305
#define F7KEY 306
#define F8KEY 307
#define F9KEY 308
#define F10KEY 309
#define F11KEY 310
#define F12KEY 311
#define F13KEY 312
#define F14KEY 313
#define F15KEY 314
#define F16KEY 315
#define F17KEY 316
#define F18KEY 317
#define F19KEY 318
#define PAUSEKEY 165
#define INSERTKEY 166
#define HOMEKEY 167
#define PAGEUPKEY 168
#define PAGEDOWNKEY 169
#define ENDKEY 170
#define UNKNOWNKEY 171
#define OSKEY 172
#define GRLESSKEY 173
// XXX: are these codes ok?
#define MEDIAPLAY 174
#define MEDIASTOP 175
#define MEDIAFIRST 176
#define MEDIALAST 177
/* for event checks */
/* only used for KM_TEXTINPUT, so assume that we want all user-inputtable ascii codes included */
/* UNUSED - see wm_eventmatch - BUG [#30479] */
// #define ISTEXTINPUT(event_type) (event_type >= ' ' && event_type <= 255)
/* note, an alternative could be to check 'event->utf8_buf' */
/* test whether the event is a key on the keyboard */
#define ISKEYBOARD(event_type) (event_type >= ' ' && event_type <= 320)
/* test whether the event is a modifier key */
#define ISKEYMODIFIER(event_type) ((event_type >= LEFTCTRLKEY && event_type <= LEFTSHIFTKEY) || event_type == OSKEY)
/* test whether the event is a mouse button */
#define ISMOUSE(event_type) (event_type >= LEFTMOUSE && event_type <= BUTTON7MOUSE)
/* test whether the event is tweak event */
#define ISTWEAK(event_type) (event_type >= EVT_TWEAK_L && event_type <= EVT_GESTURE)
/* test whether the event is a NDOF event */
#define ISNDOF(event_type) (event_type >= NDOF_MOTION && event_type < NDOF_LAST)
/* test whether event type is acceptable as hotkey, excluding modifiers */
#define ISHOTKEY(event_type) \
((ISKEYBOARD(event_type) || ISMOUSE(event_type) || ISNDOF(event_type)) && \
(event_type != ESCKEY) && \
(event_type >= LEFTCTRLKEY && event_type <= LEFTSHIFTKEY) == FALSE && \
(event_type >= UNKNOWNKEY && event_type <= GRLESSKEY) == FALSE)
/* **************** BLENDER GESTURE EVENTS (0x5000) **************** */
#define EVT_ACTIONZONE_AREA 20480
#define EVT_ACTIONZONE_REGION 20481
/* tweak events, for L M R mousebuttons */
#define EVT_TWEAK_L 20482
#define EVT_TWEAK_M 20483
#define EVT_TWEAK_R 20484
/* tweak events for action or select mousebutton */
#define EVT_TWEAK_A 20485
#define EVT_TWEAK_S 20486
#define EVT_GESTURE 20496
/* value of tweaks and line gestures, note, KM_ANY (-1) works for this case too */
#define EVT_GESTURE_N 1
#define EVT_GESTURE_NE 2
#define EVT_GESTURE_E 3
#define EVT_GESTURE_SE 4
#define EVT_GESTURE_S 5
#define EVT_GESTURE_SW 6
#define EVT_GESTURE_W 7
#define EVT_GESTURE_NW 8
/* value of corner gestures */
#define EVT_GESTURE_N_E 9
#define EVT_GESTURE_N_W 10
#define EVT_GESTURE_E_N 11
#define EVT_GESTURE_E_S 12
#define EVT_GESTURE_S_E 13
#define EVT_GESTURE_S_W 14
#define EVT_GESTURE_W_S 15
#define EVT_GESTURE_W_N 16
/* **************** OTHER BLENDER EVENTS ********************* */
/* event->type */
#define EVT_FILESELECT 0x5020
/* event->val */
#define EVT_FILESELECT_OPEN 1
#define EVT_FILESELECT_FULL_OPEN 2
#define EVT_FILESELECT_EXEC 3
#define EVT_FILESELECT_CANCEL 4
#define EVT_FILESELECT_EXTERNAL_CANCEL 5
/* event->type */
#define EVT_BUT_OPEN 0x5021
#define EVT_MODAL_MAP 0x5022
#define EVT_DROP 0x5023
#define EVT_BUT_CANCEL 0x5024
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
#define GESTURE_MODAL_CANCEL 1
#define GESTURE_MODAL_CONFIRM 2
#define GESTURE_MODAL_SELECT 3
#define GESTURE_MODAL_DESELECT 4
#define GESTURE_MODAL_NOP 5 /* circle select when no mouse button is pressed */
#define GESTURE_MODAL_CIRCLE_ADD 6 /* circle sel: larger brush */
#define GESTURE_MODAL_CIRCLE_SUB 7 /* circle sel: smaller brush */
#define GESTURE_MODAL_BEGIN 8 /* border select/straight line, activate, use release to detect which button */
#define GESTURE_MODAL_IN 9
#define GESTURE_MODAL_OUT 10
#define GESTURE_MODAL_CIRCLE_SIZE 11 /* circle sel: size brush (for trackpad event) */
#endif /* __WM_EVENT_TYPES_H__ */
|