Blender V5.0
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(
155 ", ndof: "
156 "rot: (%.4f %.4f %.4f), "
157 "tx: (%.4f %.4f %.4f), "
158 "time_delta: %.4f, "
159 "progress: %s",
160 UNPACK3(ndof.rvec),
161 UNPACK3(ndof.tvec),
162 ndof.time_delta,
163 ndof_progress);
164 }
165 else {
166 /* NDOF buttons printed already. */
167 }
168 }
169#endif /* WITH_INPUT_NDOF */
170
171 if (event->tablet.active != EVT_TABLET_NONE) {
172 const wmTabletData *wmtab = &event->tablet;
173 printf(", tablet: active: %d, pressure %.4f, tilt: (%.4f %.4f)",
174 wmtab->active,
175 wmtab->pressure,
176 wmtab->tilt.x,
177 wmtab->tilt.y);
178 }
179 printf("\n");
180 }
181 else {
182 printf("wmEvent - nullptr\n");
183 }
184}
185
187
188/* -------------------------------------------------------------------- */
191
192bool WM_event_type_mask_test(const int event_type, const enum eEventType_Mask mask)
193{
194 /* Keyboard. */
196 if (ISKEYBOARD(event_type)) {
197 return true;
198 }
199 }
201 if (ISKEYMODIFIER(event_type)) {
202 return true;
203 }
204 }
205
206 /* Mouse. */
208 if (ISMOUSE(event_type)) {
209 return true;
210 }
211 }
212 else if (mask & EVT_TYPE_MASK_MOUSE_WHEEL) {
213 if (ISMOUSE_WHEEL(event_type)) {
214 return true;
215 }
216 }
218 if (ISMOUSE_GESTURE(event_type)) {
219 return true;
220 }
221 }
222
223 /* NDOF. */
224 if (mask & EVT_TYPE_MASK_NDOF) {
225 if (ISNDOF(event_type)) {
226 return true;
227 }
228 }
229
230 /* Action Zone. */
232 if (IS_EVENT_ACTIONZONE(event_type)) {
233 return true;
234 }
235 }
236
237 return false;
238}
239
241
242/* -------------------------------------------------------------------- */
245
247 const short init_event_type,
248 const short init_event_val)
249{
250 /* If the release-confirm preference setting is enabled,
251 * drag events can be canceled when mouse is released. */
252 if (U.flag & USER_RELEASECONFIRM) {
253 /* Option on, so can exit with km-release. */
254 if (event->val == KM_RELEASE) {
255 if ((init_event_val == KM_PRESS_DRAG) && (event->type == init_event_type)) {
256 return true;
257 }
258 }
259 else {
260 /* If the initial event wasn't a drag event then
261 * ignore #USER_RELEASECONFIRM setting: see #26756. */
262 if (init_event_val != KM_PRESS_DRAG) {
263 return true;
264 }
265 }
266 }
267 else {
268 /* This is fine as long as not doing km-release, otherwise some items (i.e. markers)
269 * being tweaked may end up getting dropped all over. */
270 if (event->val != KM_RELEASE) {
271 return true;
272 }
273 }
274
275 return false;
276}
277
279{
280 return (ISMOUSE_BUTTON(event->type) && (event->val == KM_PRESS_DRAG));
281}
282
284{
285 return WM_event_is_mouse_drag(event) ||
286 (ISMOUSE_BUTTON(event->type) && (event->val == KM_PRESS));
287}
288
290{
291 const int delta[2] = {
292 event->xy[0] - event->prev_press_xy[0],
293 event->xy[1] - event->prev_press_xy[1],
294 };
295
296 int theta = round_fl_to_int(4.0f * atan2f(float(delta[1]), float(delta[0])) / float(M_PI));
297 int val = KM_DIRECTION_W;
298
299 if (theta == 0) {
300 val = KM_DIRECTION_E;
301 }
302 else if (theta == 1) {
303 val = KM_DIRECTION_NE;
304 }
305 else if (theta == 2) {
306 val = KM_DIRECTION_N;
307 }
308 else if (theta == 3) {
309 val = KM_DIRECTION_NW;
310 }
311 else if (theta == -1) {
312 val = KM_DIRECTION_SE;
313 }
314 else if (theta == -2) {
315 val = KM_DIRECTION_S;
316 }
317 else if (theta == -3) {
318 val = KM_DIRECTION_SW;
319 }
320
321#if 0
322 /* Debug. */
323 if (val == 1) {
324 printf("tweak north\n");
325 }
326 if (val == 2) {
327 printf("tweak north-east\n");
328 }
329 if (val == 3) {
330 printf("tweak east\n");
331 }
332 if (val == 4) {
333 printf("tweak south-east\n");
334 }
335 if (val == 5) {
336 printf("tweak south\n");
337 }
338 if (val == 6) {
339 printf("tweak south-west\n");
340 }
341 if (val == 7) {
342 printf("tweak west\n");
343 }
344 if (val == 8) {
345 printf("tweak north-west\n");
346 }
347#endif
348 return val;
349}
350
351bool WM_cursor_test_motion_and_update(const int mval[2])
352{
353 static int mval_prev[2] = {-1, -1};
354 bool use_cycle = (len_manhattan_v2v2_int(mval, mval_prev) <= WM_EVENT_CURSOR_MOTION_THRESHOLD);
355 copy_v2_v2_int(mval_prev, mval);
356 return !use_cycle;
357}
358
360
361/* -------------------------------------------------------------------- */
364
366{
367 return ISMOUSE_GESTURE(event->type) || (event->type == NDOF_MOTION);
368}
369
371{
372 /* Cursor motion breaks the chain. */
373 if (ISMOUSE_MOTION(event->type)) {
374 /* Mouse motion is checked because the user may navigate to a new area
375 * and perform the same gesture - logically it's best to view this as two separate gestures. */
378 {
379 return true;
380 }
381 }
382 else if (ISKEYBOARD_OR_BUTTON(event->type)) {
383 /* Modifiers are excluded because from a user perspective.
384 * For example, releasing a modifier should not begin a new action. */
385 if (!ISKEYMODIFIER(event->type)) {
386 return true;
387 }
388 }
389 else if (event->type == WINDEACTIVATE) {
390 return true;
391 }
392
393 return false;
394}
395
397
398/* -------------------------------------------------------------------- */
404
406{
407 int drag_threshold;
409 if (ISMOUSE_BUTTON(event->prev_press_type)) {
410 /* Using the previous type is important is we want to check the last pressed/released button,
411 * The `event->type` would include #MOUSEMOVE which is always the case when dragging
412 * and does not help us know which threshold to use. */
413 if (WM_event_is_tablet(event)) {
414 drag_threshold = U.drag_threshold_tablet;
415 }
416 else {
417 drag_threshold = U.drag_threshold_mouse;
418 }
419 }
420 else {
421 /* Typically keyboard, could be NDOF button or other less common types. */
422 drag_threshold = U.drag_threshold;
423 }
424 return drag_threshold * UI_SCALE_FAC;
425}
426
427bool WM_event_drag_test_with_delta(const wmEvent *event, const int drag_delta[2])
428{
429 const int drag_threshold = WM_event_drag_threshold(event);
430 return abs(drag_delta[0]) > drag_threshold || abs(drag_delta[1]) > drag_threshold;
431}
432
433bool WM_event_drag_test(const wmEvent *event, const int prev_xy[2])
434{
435 int drag_delta[2];
436 sub_v2_v2v2_int(drag_delta, prev_xy, event->xy);
437 return WM_event_drag_test_with_delta(event, drag_delta);
438}
439
440void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
441{
442 const int *xy = (event->val == KM_PRESS_DRAG) ? event->prev_press_xy : event->xy;
443 r_mval[0] = xy[0] - region->winrct.xmin;
444 r_mval[1] = xy[1] - region->winrct.ymin;
445}
446
447void WM_event_drag_start_mval_fl(const wmEvent *event, const ARegion *region, float r_mval[2])
448{
449 const int *xy = (event->val == KM_PRESS_DRAG) ? event->prev_press_xy : event->xy;
450 r_mval[0] = xy[0] - region->winrct.xmin;
451 r_mval[1] = xy[1] - region->winrct.ymin;
452}
453
454void WM_event_drag_start_xy(const wmEvent *event, int r_xy[2])
455{
456 copy_v2_v2_int(r_xy, (event->val == KM_PRESS_DRAG) ? event->prev_press_xy : event->xy);
457}
458
460
461/* -------------------------------------------------------------------- */
464
466{
467 if (BLI_str_utf8_size_or_error(event->utf8_buf) == 1) {
468 return event->utf8_buf[0];
469 }
470 return '\0';
471}
472
474
475/* -------------------------------------------------------------------- */
478
479int WM_userdef_event_map(int kmitype)
480{
481 switch (kmitype) {
482 case WHEELOUTMOUSE:
483 return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELUPMOUSE : WHEELDOWNMOUSE;
484 case WHEELINMOUSE:
485 return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE;
486 }
487
488 return kmitype;
489}
490
492{
493 switch (kmitype) {
494 case WHEELOUTMOUSE:
495 return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELUPMOUSE : WHEELDOWNMOUSE;
496 case WHEELINMOUSE:
497 return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE;
498 }
499
500 return kmitype;
501}
502
504
505/* -------------------------------------------------------------------- */
508
509#ifdef WITH_INPUT_NDOF
510
511static blender::float3 event_ndof_translation_get_with_sign(const wmNDOFMotionData &ndof,
512 const float sign)
513{
514 int ndof_flag = U.ndof_flag;
515 int x = 0, y = 1, z = 2;
516 if (ndof_flag & NDOF_SWAP_YZ_AXIS) {
517 /* Map `{x, y, z}` -> `{x, -z, y}`. */
518 std::swap(y, z);
519 ndof_flag ^= NDOF_PANY_INVERT_AXIS;
520 }
521 return {
522 ndof.tvec[x] * ((ndof_flag & NDOF_PANX_INVERT_AXIS) ? -sign : sign),
523 ndof.tvec[y] * ((ndof_flag & NDOF_PANY_INVERT_AXIS) ? -sign : sign),
524 ndof.tvec[z] * ((ndof_flag & NDOF_PANZ_INVERT_AXIS) ? -sign : sign),
525 };
526}
527
528static blender::float3 event_ndof_rotation_get_with_sign(const wmNDOFMotionData &ndof,
529 const float sign)
530{
531 int ndof_flag = U.ndof_flag;
532 int x = 0, y = 1, z = 2;
533 if (ndof_flag & NDOF_SWAP_YZ_AXIS) {
534 /* Map `{x, y, z}` -> `{x, -z, y}`. */
535 std::swap(y, z);
536 ndof_flag ^= NDOF_ROTY_INVERT_AXIS;
537 }
538 return {
539 ndof.rvec[x] * ((ndof_flag & NDOF_ROTX_INVERT_AXIS) ? -sign : sign),
540 ndof.rvec[y] * ((ndof_flag & NDOF_ROTY_INVERT_AXIS) ? -sign : sign),
541 ndof.rvec[z] * ((ndof_flag & NDOF_ROTZ_INVERT_AXIS) ? -sign : sign),
542 };
543}
544
545blender::float3 WM_event_ndof_translation_get_for_navigation(const wmNDOFMotionData &ndof)
546{
547 const float sign = (U.ndof_navigation_mode == NDOF_NAVIGATION_MODE_OBJECT) ? -1.0f : 1.0f;
548 return event_ndof_translation_get_with_sign(ndof, sign);
549}
550
551blender::float3 WM_event_ndof_rotation_get_for_navigation(const wmNDOFMotionData &ndof)
552{
553 const float sign = (U.ndof_navigation_mode == NDOF_NAVIGATION_MODE_OBJECT) ? -1.0f : 1.0f;
554 return event_ndof_rotation_get_with_sign(ndof, sign);
555}
556
557blender::float3 WM_event_ndof_translation_get(const wmNDOFMotionData &ndof)
558{
559 return event_ndof_translation_get_with_sign(ndof, 1.0f);
560}
561
562blender::float3 WM_event_ndof_rotation_get(const wmNDOFMotionData &ndof)
563{
564 return event_ndof_rotation_get_with_sign(ndof, 1.0f);
565}
566
567float WM_event_ndof_rotation_get_axis_angle_for_navigation(const wmNDOFMotionData &ndof,
568 float axis[3])
569{
570 const blender::float3 rvec = WM_event_ndof_rotation_get_for_navigation(ndof);
571 return normalize_v3_v3(axis, rvec);
572}
573
574float WM_event_ndof_rotation_get_axis_angle(const wmNDOFMotionData &ndof, float axis[3])
575{
576 const blender::float3 rvec = WM_event_ndof_rotation_get(ndof);
577 return normalize_v3_v3(axis, rvec);
578}
579
580bool WM_event_ndof_translation_has_pan(const wmNDOFMotionData &ndof)
581{
582 return (U.ndof_flag & NDOF_SWAP_YZ_AXIS) ? ((ndof.tvec[0] != 0.0f) || (ndof.tvec[2] != 0.0f)) :
583 ((ndof.tvec[0] != 0.0f) || (ndof.tvec[1] != 0.0f));
584}
585
586bool WM_event_ndof_translation_has_zoom(const wmNDOFMotionData &ndof)
587{
588 return ndof.tvec[(U.ndof_flag & NDOF_SWAP_YZ_AXIS) ? 1 : 2] != 0.0f;
589}
590
591#endif /* WITH_INPUT_NDOF */
592
594
595/* -------------------------------------------------------------------- */
598
599#ifdef WITH_XR_OPENXR
600bool WM_event_is_xr(const wmEvent *event)
601{
602 return (event->type == EVT_XR_ACTION && event->custom == EVT_DATA_XR);
603}
604#endif
605
607
608/* -------------------------------------------------------------------- */
611
612float wm_pressure_curve(float raw_pressure)
613{
614 if (U.pressure_threshold_max != 0.0f) {
615 raw_pressure /= U.pressure_threshold_max;
616 }
617
618 CLAMP(raw_pressure, 0.0f, 1.0f);
619
620 if (U.pressure_softness != 0.0f) {
621 raw_pressure = powf(raw_pressure, powf(4.0f, -U.pressure_softness));
622 }
623
624 return raw_pressure;
625}
626
627float WM_event_tablet_data(const wmEvent *event, bool *r_pen_flip, float r_tilt[2])
628{
629 if (r_tilt) {
630 copy_v2_v2(r_tilt, event->tablet.tilt);
631 }
632
633 if (r_pen_flip) {
634 (*r_pen_flip) = (event->tablet.active == EVT_TABLET_ERASER);
635 }
636
637 return event->tablet.pressure;
638}
639
640bool WM_event_is_tablet(const wmEvent *event)
641{
642 return (event->tablet.active != EVT_TABLET_NONE);
643}
644
646
647/* -------------------------------------------------------------------- */
654
656{
657 int dx = event->xy[0] - event->prev_xy[0];
658
659 if ((event->flag & WM_EVENT_SCROLL_INVERT) == 0) {
660 dx = -dx;
661 }
662
663 return dx;
664}
665
667{
668 int dy = event->xy[1] - event->prev_xy[1];
669
670 if ((event->flag & WM_EVENT_SCROLL_INVERT) == 0) {
671 dy = -dy;
672 }
673
674 return dy;
675}
676
678
679/* -------------------------------------------------------------------- */
682
683#ifdef WITH_INPUT_IME
684bool WM_event_is_ime_switch(const wmEvent *event)
685{
686 /* Most OS's use `Ctrl+Space` / `OsKey+Space` to switch IME,
687 * so don't type in the space character.
688 *
689 * NOTE: Shift is excluded from this check since it prevented typing `Shift+Space`, see: #85517.
690 */
691 return (event->val == KM_PRESS) && (event->type == EVT_SPACEKEY) &&
692 (event->modifier & (KM_CTRL | KM_OSKEY | KM_ALT));
693}
694#endif
695
#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:279
@ KM_ALT
Definition WM_types.hh:280
@ KM_HYPER
Definition WM_types.hh:292
@ KM_OSKEY
Definition WM_types.hh:282
@ KM_SHIFT
Definition WM_types.hh:278
@ WM_EVENT_FORCE_DRAG_THRESHOLD
Definition WM_types.hh:697
@ WM_EVENT_SCROLL_INVERT
Definition WM_types.hh:677
@ WM_EVENT_IS_CONSECUTIVE
Definition WM_types.hh:692
@ WM_EVENT_IS_REPEAT
Definition WM_types.hh:684
@ KM_PRESS
Definition WM_types.hh:311
@ KM_PRESS_DRAG
Definition WM_types.hh:319
@ KM_RELEASE
Definition WM_types.hh:312
#define WM_EVENT_CURSOR_MOTION_THRESHOLD
Definition WM_types.hh:844
@ KM_DIRECTION_NW
Definition WM_types.hh:341
@ KM_DIRECTION_N
Definition WM_types.hh:334
@ KM_DIRECTION_SW
Definition WM_types.hh:339
@ KM_DIRECTION_NE
Definition WM_types.hh:335
@ KM_DIRECTION_E
Definition WM_types.hh:336
@ KM_DIRECTION_W
Definition WM_types.hh:340
@ KM_DIRECTION_SE
Definition WM_types.hh:337
@ KM_DIRECTION_S
Definition WM_types.hh:338
#define U
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
#define powf(x, y)
#define str(s)
#define printf(...)
constexpr T sign(T) RET
#define abs
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
VecBase< float, 3 > float3
#define atan2f
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:812
wmEventModifierFlag modifier
Definition WM_types.hh:774
wmEventType type
Definition WM_types.hh:757
short custom
Definition WM_types.hh:793
wmEventType prev_press_type
Definition WM_types.hh:825
short val
Definition WM_types.hh:759
int xy[2]
Definition WM_types.hh:761
char utf8_buf[6]
Definition WM_types.hh:771
wmTabletData tablet
Definition WM_types.hh:786
eWM_EventFlag flag
Definition WM_types.hh:788
short prev_val
Definition WM_types.hh:814
int prev_press_xy[2]
Definition WM_types.hh:830
wmEventType keymodifier
Definition WM_types.hh:783
float pressure
Definition WM_types.hh:705
blender::float2 tilt
Definition WM_types.hh:710
int event_queue_consecutive_gesture_xy[2]
i
Definition text_draw.cc:230
int xy[2]
Definition wm_draw.cc:178
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)
@ EVT_DATA_XR
@ EVT_TABLET_NONE
@ EVT_TABLET_ERASER
#define ISKEYBOARD_OR_BUTTON(event_type)
#define ISMOUSE_MOTION(event_type)
#define ISMOUSE_WHEEL(event_type)
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:145