Blender V4.5
wm_event_query.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2007 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include <cstdlib>
12#include <cstring>
13
14#include "DNA_screen_types.h"
15#include "DNA_userdef_types.h"
17
18#include "BLI_math_rotation.h"
19#include "BLI_math_vector.h"
20#include "BLI_string.h"
21#include "BLI_string_utf8.h"
22#include "BLI_utildefines.h"
23
24#include "RNA_access.hh"
25
26#include "WM_api.hh"
27#include "WM_types.hh"
28
29#include "wm_event_system.hh"
30#include "wm_event_types.hh"
31
32#include "RNA_enum_types.hh"
33
34/* -------------------------------------------------------------------- */
37
39 const char *id;
41};
42
43static void event_ids_from_flag(char *str,
44 const int str_maxncpy,
45 const FlagIdentifierPair *flag_data,
46 const int flag_data_len,
47 const uint flag)
48{
49 int ofs = 0;
50 ofs += BLI_strncpy_rlen(str + ofs, "{", str_maxncpy - ofs);
51 for (int i = 0; i < flag_data_len; i++) {
52 if (flag & flag_data[i].flag) {
53 if (ofs != 1) {
54 ofs += BLI_strncpy_rlen(str + ofs, "|", str_maxncpy - ofs);
55 }
56 ofs += BLI_strncpy_rlen(str + ofs, flag_data[i].id, str_maxncpy - ofs);
57 }
58 }
59 ofs += BLI_strncpy_rlen(str + ofs, "}", str_maxncpy - ofs);
60 UNUSED_VARS(ofs); /* Quiet warning. */
61}
62
63static void event_ids_from_type_and_value(const short type,
64 const short val,
65 const char **r_type_id,
66 const char **r_val_id)
67{
68 /* Type. */
70
71 /* Value. */
73}
74
75void WM_event_print(const wmEvent *event)
76{
77 if (event) {
78 const char *unknown = "UNKNOWN";
79 const char *type_id = unknown;
80 const char *val_id = unknown;
81 const char *prev_type_id = unknown;
82 const char *prev_val_id = unknown;
83
84 event_ids_from_type_and_value(event->type, event->val, &type_id, &val_id);
85 event_ids_from_type_and_value(event->prev_type, event->prev_val, &prev_type_id, &prev_val_id);
86
87 char modifier_id[128];
88 {
89 FlagIdentifierPair flag_data[] = {
90 {"SHIFT", KM_SHIFT},
91 {"CTRL", KM_CTRL},
92 {"ALT", KM_ALT},
93 {"OS", KM_OSKEY},
94 {"HYPER", KM_HYPER},
95
96 };
98 modifier_id, sizeof(modifier_id), flag_data, ARRAY_SIZE(flag_data), event->modifier);
99 }
100
101 char flag_id[128];
102 {
103 FlagIdentifierPair flag_data[] = {
104 {"SCROLL_INVERT", WM_EVENT_SCROLL_INVERT},
105 {"IS_REPEAT", WM_EVENT_IS_REPEAT},
106 {"IS_CONSECUTIVE", WM_EVENT_IS_CONSECUTIVE},
107 {"FORCE_DRAG_THRESHOLD", WM_EVENT_FORCE_DRAG_THRESHOLD},
108 };
109 event_ids_from_flag(flag_id, sizeof(flag_id), flag_data, ARRAY_SIZE(flag_data), event->flag);
110 }
111
112 printf(
113 "wmEvent type:%d/%s, val:%d/%s, "
114 "prev_type:%d/%s, prev_val:%d/%s, "
115 "modifier=%s, keymodifier:%d, flag:%s, "
116 "mouse:(%d,%d), utf8:'%.*s', pointer:%p",
117 event->type,
118 type_id,
119 event->val,
120 val_id,
121 event->prev_type,
122 prev_type_id,
123 event->prev_val,
124 prev_val_id,
125 modifier_id,
126 event->keymodifier,
127 flag_id,
128 event->xy[0],
129 event->xy[1],
131 event->utf8_buf,
132 (const void *)event);
133
134#ifdef WITH_INPUT_NDOF
135 if (ISNDOF(event->type)) {
136 const wmNDOFMotionData *ndof = static_cast<const wmNDOFMotionData *>(event->customdata);
137 if (event->type == NDOF_MOTION) {
138 const char *ndof_progress = unknown;
139
140# define CASE_NDOF_PROGRESS(id) \
141 case P_##id: { \
142 ndof_progress = STRINGIFY(id); \
143 break; \
144 }
145 switch (ndof->progress) {
146 CASE_NDOF_PROGRESS(NOT_STARTED);
147 CASE_NDOF_PROGRESS(STARTING);
148 CASE_NDOF_PROGRESS(IN_PROGRESS);
149 CASE_NDOF_PROGRESS(FINISHING);
150 CASE_NDOF_PROGRESS(FINISHED);
151 }
152# undef CASE_NDOF_PROGRESS
153
154 printf(", ndof: rot: (%.4f %.4f %.4f), tx: (%.4f %.4f %.4f), dt: %.4f, progress: %s",
155 UNPACK3(ndof->rvec),
156 UNPACK3(ndof->tvec),
157 ndof->dt,
158 ndof_progress);
159 }
160 else {
161 /* NDOF buttons printed already. */
162 }
163 }
164#endif /* WITH_INPUT_NDOF */
165
166 if (event->tablet.active != EVT_TABLET_NONE) {
167 const wmTabletData *wmtab = &event->tablet;
168 printf(", tablet: active: %d, pressure %.4f, tilt: (%.4f %.4f)",
169 wmtab->active,
170 wmtab->pressure,
171 wmtab->tilt.x,
172 wmtab->tilt.y);
173 }
174 printf("\n");
175 }
176 else {
177 printf("wmEvent - nullptr\n");
178 }
179}
180
182
183/* -------------------------------------------------------------------- */
186
187bool WM_event_type_mask_test(const int event_type, const enum eEventType_Mask mask)
188{
189 /* Keyboard. */
191 if (ISKEYBOARD(event_type)) {
192 return true;
193 }
194 }
196 if (ISKEYMODIFIER(event_type)) {
197 return true;
198 }
199 }
200
201 /* Mouse. */
203 if (ISMOUSE(event_type)) {
204 return true;
205 }
206 }
207 else if (mask & EVT_TYPE_MASK_MOUSE_WHEEL) {
208 if (ISMOUSE_WHEEL(event_type)) {
209 return true;
210 }
211 }
213 if (ISMOUSE_GESTURE(event_type)) {
214 return true;
215 }
216 }
217
218 /* NDOF. */
219 if (mask & EVT_TYPE_MASK_NDOF) {
220 if (ISNDOF(event_type)) {
221 return true;
222 }
223 }
224
225 /* Action Zone. */
227 if (IS_EVENT_ACTIONZONE(event_type)) {
228 return true;
229 }
230 }
231
232 return false;
233}
234
236
237/* -------------------------------------------------------------------- */
240
242 const short init_event_type,
243 const short init_event_val)
244{
245 /* If the release-confirm preference setting is enabled,
246 * drag events can be canceled when mouse is released. */
247 if (U.flag & USER_RELEASECONFIRM) {
248 /* Option on, so can exit with km-release. */
249 if (event->val == KM_RELEASE) {
250 if ((init_event_val == KM_CLICK_DRAG) && (event->type == init_event_type)) {
251 return true;
252 }
253 }
254 else {
255 /* If the initial event wasn't a drag event then
256 * ignore #USER_RELEASECONFIRM setting: see #26756. */
257 if (init_event_val != KM_CLICK_DRAG) {
258 return true;
259 }
260 }
261 }
262 else {
263 /* This is fine as long as not doing km-release, otherwise some items (i.e. markers)
264 * being tweaked may end up getting dropped all over. */
265 if (event->val != KM_RELEASE) {
266 return true;
267 }
268 }
269
270 return false;
271}
272
274{
275 return (ISMOUSE_BUTTON(event->type) && (event->val == KM_CLICK_DRAG));
276}
277
279{
280 return WM_event_is_mouse_drag(event) ||
281 (ISMOUSE_BUTTON(event->type) && (event->val == KM_PRESS));
282}
283
285{
286 const int delta[2] = {
287 event->xy[0] - event->prev_press_xy[0],
288 event->xy[1] - event->prev_press_xy[1],
289 };
290
291 int theta = round_fl_to_int(4.0f * atan2f(float(delta[1]), float(delta[0])) / float(M_PI));
292 int val = KM_DIRECTION_W;
293
294 if (theta == 0) {
295 val = KM_DIRECTION_E;
296 }
297 else if (theta == 1) {
298 val = KM_DIRECTION_NE;
299 }
300 else if (theta == 2) {
301 val = KM_DIRECTION_N;
302 }
303 else if (theta == 3) {
304 val = KM_DIRECTION_NW;
305 }
306 else if (theta == -1) {
307 val = KM_DIRECTION_SE;
308 }
309 else if (theta == -2) {
310 val = KM_DIRECTION_S;
311 }
312 else if (theta == -3) {
313 val = KM_DIRECTION_SW;
314 }
315
316#if 0
317 /* Debug. */
318 if (val == 1) {
319 printf("tweak north\n");
320 }
321 if (val == 2) {
322 printf("tweak north-east\n");
323 }
324 if (val == 3) {
325 printf("tweak east\n");
326 }
327 if (val == 4) {
328 printf("tweak south-east\n");
329 }
330 if (val == 5) {
331 printf("tweak south\n");
332 }
333 if (val == 6) {
334 printf("tweak south-west\n");
335 }
336 if (val == 7) {
337 printf("tweak west\n");
338 }
339 if (val == 8) {
340 printf("tweak north-west\n");
341 }
342#endif
343 return val;
344}
345
346bool WM_cursor_test_motion_and_update(const int mval[2])
347{
348 static int mval_prev[2] = {-1, -1};
349 bool use_cycle = (len_manhattan_v2v2_int(mval, mval_prev) <= WM_EVENT_CURSOR_MOTION_THRESHOLD);
350 copy_v2_v2_int(mval_prev, mval);
351 return !use_cycle;
352}
353
355
356/* -------------------------------------------------------------------- */
359
361{
362 return ISMOUSE_GESTURE(event->type) || (event->type == NDOF_MOTION);
363}
364
366{
367 /* Cursor motion breaks the chain. */
368 if (ISMOUSE_MOTION(event->type)) {
369 /* Mouse motion is checked because the user may navigate to a new area
370 * and perform the same gesture - logically it's best to view this as two separate gestures. */
373 {
374 return true;
375 }
376 }
377 else if (ISKEYBOARD_OR_BUTTON(event->type)) {
378 /* Modifiers are excluded because from a user perspective.
379 * For example, releasing a modifier should not begin a new action. */
380 if (!ISKEYMODIFIER(event->type)) {
381 return true;
382 }
383 }
384 else if (event->type == WINDEACTIVATE) {
385 return true;
386 }
387
388 return false;
389}
390
392
393/* -------------------------------------------------------------------- */
399
401{
402 int drag_threshold;
404 if (ISMOUSE_BUTTON(event->prev_press_type)) {
405 /* Using the previous type is important is we want to check the last pressed/released button,
406 * The `event->type` would include #MOUSEMOVE which is always the case when dragging
407 * and does not help us know which threshold to use. */
408 if (WM_event_is_tablet(event)) {
409 drag_threshold = U.drag_threshold_tablet;
410 }
411 else {
412 drag_threshold = U.drag_threshold_mouse;
413 }
414 }
415 else {
416 /* Typically keyboard, could be NDOF button or other less common types. */
417 drag_threshold = U.drag_threshold;
418 }
419 return drag_threshold * UI_SCALE_FAC;
420}
421
422bool WM_event_drag_test_with_delta(const wmEvent *event, const int drag_delta[2])
423{
424 const int drag_threshold = WM_event_drag_threshold(event);
425 return abs(drag_delta[0]) > drag_threshold || abs(drag_delta[1]) > drag_threshold;
426}
427
428bool WM_event_drag_test(const wmEvent *event, const int prev_xy[2])
429{
430 int drag_delta[2];
431 sub_v2_v2v2_int(drag_delta, prev_xy, event->xy);
432 return WM_event_drag_test_with_delta(event, drag_delta);
433}
434
435void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
436{
437 const int *xy = (event->val == KM_CLICK_DRAG) ? event->prev_press_xy : event->xy;
438 r_mval[0] = xy[0] - region->winrct.xmin;
439 r_mval[1] = xy[1] - region->winrct.ymin;
440}
441
442void WM_event_drag_start_mval_fl(const wmEvent *event, const ARegion *region, float r_mval[2])
443{
444 const int *xy = (event->val == KM_CLICK_DRAG) ? event->prev_press_xy : event->xy;
445 r_mval[0] = xy[0] - region->winrct.xmin;
446 r_mval[1] = xy[1] - region->winrct.ymin;
447}
448
449void WM_event_drag_start_xy(const wmEvent *event, int r_xy[2])
450{
451 copy_v2_v2_int(r_xy, (event->val == KM_CLICK_DRAG) ? event->prev_press_xy : event->xy);
452}
453
455
456/* -------------------------------------------------------------------- */
459
461{
462 if (BLI_str_utf8_size_or_error(event->utf8_buf) == 1) {
463 return event->utf8_buf[0];
464 }
465 return '\0';
466}
467
469
470/* -------------------------------------------------------------------- */
473
474int WM_userdef_event_map(int kmitype)
475{
476 switch (kmitype) {
477 case WHEELOUTMOUSE:
478 return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELUPMOUSE : WHEELDOWNMOUSE;
479 case WHEELINMOUSE:
480 return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE;
481 }
482
483 return kmitype;
484}
485
487{
488 switch (kmitype) {
489 case WHEELOUTMOUSE:
490 return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELUPMOUSE : WHEELDOWNMOUSE;
491 case WHEELINMOUSE:
492 return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE;
493 }
494
495 return kmitype;
496}
497
499
500/* -------------------------------------------------------------------- */
503
504#ifdef WITH_INPUT_NDOF
505
506static blender::float3 event_ndof_translation_get_with_sign(const wmNDOFMotionData &ndof,
507 const float sign)
508{
509 int ndof_flag = U.ndof_flag;
510 int x = 0, y = 1, z = 2;
511 if (ndof_flag & NDOF_SWAP_YZ_AXIS) {
512 /* Map `{x, y, z}` -> `{x, -z, y}`. */
513 std::swap(y, z);
514 ndof_flag ^= NDOF_PANY_INVERT_AXIS;
515 }
516 return {
517 ndof.tvec[x] * ((ndof_flag & NDOF_PANX_INVERT_AXIS) ? -sign : sign),
518 ndof.tvec[y] * ((ndof_flag & NDOF_PANY_INVERT_AXIS) ? -sign : sign),
519 ndof.tvec[z] * ((ndof_flag & NDOF_PANZ_INVERT_AXIS) ? -sign : sign),
520 };
521}
522
523static blender::float3 event_ndof_rotation_get_with_sign(const wmNDOFMotionData &ndof,
524 const float sign)
525{
526 int ndof_flag = U.ndof_flag;
527 int x = 0, y = 1, z = 2;
528 if (ndof_flag & NDOF_SWAP_YZ_AXIS) {
529 /* Map `{x, y, z}` -> `{x, -z, y}`. */
530 std::swap(y, z);
531 ndof_flag ^= NDOF_ROTY_INVERT_AXIS;
532 }
533 return {
534 ndof.rvec[x] * ((ndof_flag & NDOF_ROTX_INVERT_AXIS) ? -sign : sign),
535 ndof.rvec[y] * ((ndof_flag & NDOF_ROTY_INVERT_AXIS) ? -sign : sign),
536 ndof.rvec[z] * ((ndof_flag & NDOF_ROTZ_INVERT_AXIS) ? -sign : sign),
537 };
538}
539
540blender::float3 WM_event_ndof_translation_get_for_navigation(const wmNDOFMotionData &ndof)
541{
542 const float sign = (U.ndof_navigation_mode == NDOF_NAVIGATION_MODE_OBJECT) ? -1.0f : 1.0f;
543 return event_ndof_translation_get_with_sign(ndof, sign);
544}
545
546blender::float3 WM_event_ndof_rotation_get_for_navigation(const wmNDOFMotionData &ndof)
547{
548 const float sign = (U.ndof_navigation_mode == NDOF_NAVIGATION_MODE_OBJECT) ? -1.0f : 1.0f;
549 return event_ndof_rotation_get_with_sign(ndof, sign);
550}
551
552blender::float3 WM_event_ndof_translation_get(const wmNDOFMotionData &ndof)
553{
554 return event_ndof_translation_get_with_sign(ndof, 1.0f);
555}
556
557blender::float3 WM_event_ndof_rotation_get(const wmNDOFMotionData &ndof)
558{
559 return event_ndof_rotation_get_with_sign(ndof, 1.0f);
560}
561
562float WM_event_ndof_rotation_get_axis_angle_for_navigation(const wmNDOFMotionData &ndof,
563 float axis[3])
564{
565 const blender::float3 rvec = WM_event_ndof_rotation_get_for_navigation(ndof);
566 return normalize_v3_v3(axis, rvec);
567}
568
569float WM_event_ndof_rotation_get_axis_angle(const wmNDOFMotionData &ndof, float axis[3])
570{
571 const blender::float3 rvec = WM_event_ndof_rotation_get(ndof);
572 return normalize_v3_v3(axis, rvec);
573}
574
575bool WM_event_ndof_translation_has_pan(const wmNDOFMotionData &ndof)
576{
577 return (U.ndof_flag & NDOF_SWAP_YZ_AXIS) ? ((ndof.tvec[0] != 0.0f) || (ndof.tvec[2] != 0.0f)) :
578 ((ndof.tvec[0] != 0.0f) || (ndof.tvec[1] != 0.0f));
579}
580
581bool WM_event_ndof_translation_has_zoom(const wmNDOFMotionData &ndof)
582{
583 return ndof.tvec[(U.ndof_flag & NDOF_SWAP_YZ_AXIS) ? 1 : 2] != 0.0f;
584}
585
586#endif /* WITH_INPUT_NDOF */
587
589
590/* -------------------------------------------------------------------- */
593
594#ifdef WITH_XR_OPENXR
595bool WM_event_is_xr(const wmEvent *event)
596{
597 return (event->type == EVT_XR_ACTION && event->custom == EVT_DATA_XR);
598}
599#endif
600
602
603/* -------------------------------------------------------------------- */
606
607float wm_pressure_curve(float raw_pressure)
608{
609 if (U.pressure_threshold_max != 0.0f) {
610 raw_pressure /= U.pressure_threshold_max;
611 }
612
613 CLAMP(raw_pressure, 0.0f, 1.0f);
614
615 if (U.pressure_softness != 0.0f) {
616 raw_pressure = powf(raw_pressure, powf(4.0f, -U.pressure_softness));
617 }
618
619 return raw_pressure;
620}
621
622float WM_event_tablet_data(const wmEvent *event, bool *r_pen_flip, float r_tilt[2])
623{
624 if (r_tilt) {
625 copy_v2_v2(r_tilt, event->tablet.tilt);
626 }
627
628 if (r_pen_flip) {
629 (*r_pen_flip) = (event->tablet.active == EVT_TABLET_ERASER);
630 }
631
632 return event->tablet.pressure;
633}
634
635bool WM_event_is_tablet(const wmEvent *event)
636{
637 return (event->tablet.active != EVT_TABLET_NONE);
638}
639
641
642/* -------------------------------------------------------------------- */
649
651{
652 int dx = event->xy[0] - event->prev_xy[0];
653
654 if ((event->flag & WM_EVENT_SCROLL_INVERT) == 0) {
655 dx = -dx;
656 }
657
658 return dx;
659}
660
662{
663 int dy = event->xy[1] - event->prev_xy[1];
664
665 if ((event->flag & WM_EVENT_SCROLL_INVERT) == 0) {
666 dy = -dy;
667 }
668
669 return dy;
670}
671
673
674/* -------------------------------------------------------------------- */
677
678#ifdef WITH_INPUT_IME
679bool WM_event_is_ime_switch(const wmEvent *event)
680{
681 /* Most OS's use `Ctrl+Space` / `OsKey+Space` to switch IME,
682 * so don't type in the space character.
683 *
684 * NOTE: Shift is excluded from this check since it prevented typing `Shift+Space`, see: #85517.
685 */
686 return (event->val == KM_PRESS) && (event->type == EVT_SPACEKEY) &&
687 (event->modifier & (KM_CTRL | KM_OSKEY | KM_ALT));
688}
689#endif
690
#define BLI_assert(a)
Definition BLI_assert.h:46
MINLINE int round_fl_to_int(float a)
#define M_PI
MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE int len_manhattan_v2v2_int(const int a[2], const int b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_v3(float r[3], const float a[3])
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
const char int BLI_str_utf8_size_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
unsigned int uint
#define CLAMP(a, b, c)
#define ARRAY_SIZE(arr)
#define UNUSED_VARS(...)
#define UNPACK3(a)
#define UI_SCALE_FAC
@ USER_WHEELZOOMDIR
@ USER_RELEASECONFIRM
@ NDOF_NAVIGATION_MODE_OBJECT
@ NDOF_ROTX_INVERT_AXIS
@ NDOF_PANX_INVERT_AXIS
@ NDOF_PANY_INVERT_AXIS
@ NDOF_ROTY_INVERT_AXIS
@ NDOF_SWAP_YZ_AXIS
@ NDOF_PANZ_INVERT_AXIS
@ NDOF_ROTZ_INVERT_AXIS
@ KM_CTRL
Definition WM_types.hh:276
@ KM_ALT
Definition WM_types.hh:277
@ KM_HYPER
Definition WM_types.hh:289
@ KM_OSKEY
Definition WM_types.hh:279
@ KM_SHIFT
Definition WM_types.hh:275
@ WM_EVENT_FORCE_DRAG_THRESHOLD
Definition WM_types.hh:694
@ WM_EVENT_SCROLL_INVERT
Definition WM_types.hh:674
@ WM_EVENT_IS_CONSECUTIVE
Definition WM_types.hh:689
@ WM_EVENT_IS_REPEAT
Definition WM_types.hh:681
@ KM_DIRECTION_NW
Definition WM_types.hh:338
@ KM_DIRECTION_N
Definition WM_types.hh:331
@ KM_DIRECTION_SW
Definition WM_types.hh:336
@ KM_DIRECTION_NE
Definition WM_types.hh:332
@ KM_DIRECTION_E
Definition WM_types.hh:333
@ KM_DIRECTION_W
Definition WM_types.hh:337
@ KM_DIRECTION_SE
Definition WM_types.hh:334
@ KM_DIRECTION_S
Definition WM_types.hh:335
#define WM_EVENT_CURSOR_MOTION_THRESHOLD
Definition WM_types.hh:841
@ KM_PRESS
Definition WM_types.hh:308
@ KM_CLICK_DRAG
Definition WM_types.hh:316
@ KM_RELEASE
Definition WM_types.hh:309
#define U
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
#define powf(x, y)
#define atan2f(x, y)
#define str(s)
constexpr T sign(T) RET
#define abs
#define printf(...)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
VecBase< float, 3 > float3
bool RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **r_identifier)
const EnumPropertyItem rna_enum_event_value_items[]
Definition rna_wm.cc:477
const EnumPropertyItem rna_enum_event_type_items[]
Definition rna_wm.cc:215
int ymin
int xmin
wmEventType prev_type
Definition WM_types.hh:809
wmEventModifierFlag modifier
Definition WM_types.hh:771
wmEventType type
Definition WM_types.hh:754
short custom
Definition WM_types.hh:790
wmEventType prev_press_type
Definition WM_types.hh:822
short val
Definition WM_types.hh:756
int xy[2]
Definition WM_types.hh:758
char utf8_buf[6]
Definition WM_types.hh:768
wmTabletData tablet
Definition WM_types.hh:783
eWM_EventFlag flag
Definition WM_types.hh:785
short prev_val
Definition WM_types.hh:811
int prev_press_xy[2]
Definition WM_types.hh:827
wmEventType keymodifier
Definition WM_types.hh:780
float pressure
Definition WM_types.hh:702
blender::float2 tilt
Definition WM_types.hh:707
int event_queue_consecutive_gesture_xy[2]
i
Definition text_draw.cc:230
int xy[2]
Definition wm_draw.cc:174
float WM_event_tablet_data(const wmEvent *event, bool *r_pen_flip, float r_tilt[2])
float wm_pressure_curve(float raw_pressure)
bool WM_event_consecutive_gesture_test_break(const wmWindow *win, const wmEvent *event)
bool WM_event_drag_test_with_delta(const wmEvent *event, const int drag_delta[2])
static void event_ids_from_flag(char *str, const int str_maxncpy, const FlagIdentifierPair *flag_data, const int flag_data_len, const uint flag)
int WM_event_drag_direction(const wmEvent *event)
int WM_event_absolute_delta_y(const wmEvent *event)
void WM_event_print(const wmEvent *event)
bool WM_event_drag_test(const wmEvent *event, const int prev_xy[2])
int WM_userdef_event_map(int kmitype)
void WM_event_drag_start_mval_fl(const wmEvent *event, const ARegion *region, float r_mval[2])
bool WM_event_is_mouse_drag(const wmEvent *event)
bool WM_event_consecutive_gesture_test(const wmEvent *event)
bool WM_event_type_mask_test(const int event_type, const enum eEventType_Mask mask)
void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
void WM_event_drag_start_xy(const wmEvent *event, int r_xy[2])
char WM_event_utf8_to_ascii(const wmEvent *event)
bool WM_event_is_mouse_drag_or_press(const wmEvent *event)
bool WM_event_is_modal_drag_exit(const wmEvent *event, const short init_event_type, const short init_event_val)
int WM_event_absolute_delta_x(const wmEvent *event)
static void event_ids_from_type_and_value(const short type, const short val, const char **r_type_id, const char **r_val_id)
int WM_userdef_event_type_from_keymap_type(int kmitype)
bool WM_event_is_tablet(const wmEvent *event)
bool WM_cursor_test_motion_and_update(const int mval[2])
int WM_event_drag_threshold(const wmEvent *event)
#define ISMOUSE_BUTTON(event_type)
#define ISKEYBOARD_OR_BUTTON(event_type)
#define ISMOUSE_MOTION(event_type)
#define ISMOUSE_WHEEL(event_type)
@ EVT_TABLET_NONE
@ EVT_TABLET_ERASER
@ EVT_DATA_XR
eEventType_Mask
@ EVT_TYPE_MASK_ACTIONZONE
@ EVT_TYPE_MASK_KEYBOARD_MODIFIER
@ EVT_TYPE_MASK_NDOF
@ EVT_TYPE_MASK_MOUSE_WHEEL
@ EVT_TYPE_MASK_MOUSE_GESTURE
@ EVT_TYPE_MASK_MOUSE
@ EVT_TYPE_MASK_KEYBOARD
#define ISKEYMODIFIER(event_type)
@ WHEELUPMOUSE
@ EVT_SPACEKEY
@ WHEELDOWNMOUSE
@ MOUSEMOVE
@ NDOF_MOTION
@ WHEELOUTMOUSE
@ WHEELINMOUSE
@ WINDEACTIVATE
@ EVT_XR_ACTION
#define IS_EVENT_ACTIONZONE(event_type)
#define ISMOUSE_GESTURE(event_type)
#define ISKEYBOARD(event_type)
#define ISNDOF(event_type)
#define ISMOUSE(event_type)
uint8_t flag
Definition wm_window.cc:139