Blender
V3.3
|
#include <stdlib.h>
#include <string.h>
#include "DNA_listBase.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "RNA_access.h"
#include "WM_api.h"
#include "WM_types.h"
#include "wm_event_system.h"
#include "wm_event_types.h"
#include "RNA_enum_types.h"
#include "DEG_depsgraph.h"
Go to the source code of this file.
Classes | |
struct | FlagIdentifierPair |
Functions | |
Event Printing | |
static void | event_ids_from_flag (char *str, const int str_maxlen, const struct FlagIdentifierPair *flag_data, const int flag_data_len, const uint flag) |
static void | event_ids_from_type_and_value (const short type, const short val, const char **r_type_id, const char **r_val_id) |
void | WM_event_print (const wmEvent *event) |
Event Modifier/Type Queries | |
bool | WM_event_type_mask_test (const int event_type, const enum eEventType_Mask mask) |
Event Motion Queries | |
bool | WM_event_is_modal_drag_exit (const wmEvent *event, const short init_event_type, const short init_event_val) |
bool | WM_event_is_mouse_drag (const wmEvent *event) |
bool | WM_event_is_mouse_drag_or_press (const wmEvent *event) |
int | WM_event_drag_direction (const wmEvent *event) |
bool | WM_cursor_test_motion_and_update (const int mval[2]) |
Event Click/Drag Checks | |
Values under this limit are detected as clicks. | |
int | WM_event_drag_threshold (const struct wmEvent *event) |
bool | WM_event_drag_test_with_delta (const wmEvent *event, const int drag_delta[2]) |
bool | WM_event_drag_test (const wmEvent *event, const int prev_xy[2]) |
void | WM_event_drag_start_mval (const wmEvent *event, const ARegion *region, int r_mval[2]) |
void | WM_event_drag_start_mval_fl (const wmEvent *event, const ARegion *region, float r_mval[2]) |
void | WM_event_drag_start_xy (const wmEvent *event, int r_xy[2]) |
Event Text Queries | |
char | WM_event_utf8_to_ascii (const struct wmEvent *event) |
Event Preference Mapping | |
int | WM_userdef_event_map (int kmitype) |
int | WM_userdef_event_type_from_keymap_type (int kmitype) |
Event Tablet Input Access | |
float | wm_pressure_curve (float pressure) |
float | WM_event_tablet_data (const wmEvent *event, int *pen_flip, float tilt[2]) |
bool | WM_event_is_tablet (const struct wmEvent *event) |
Event Scroll's Absolute Deltas | |
User may change the scroll behavior, and the deltas are automatically inverted. These functions return the absolute direction, swipe up/right gives positive values. | |
int | WM_event_absolute_delta_x (const struct wmEvent *event) |
int | WM_event_absolute_delta_y (const struct wmEvent *event) |
Read-only queries utility functions for the event system.
Definition in file wm_event_query.c.
|
static |
Definition at line 46 of file wm_event_query.c.
References BLI_strncpy_rlen(), and str.
Referenced by WM_event_print().
|
static |
Definition at line 65 of file wm_event_query.c.
References rna_enum_event_type_items, rna_enum_event_value_items, RNA_enum_identifier(), and type.
Referenced by WM_event_print().
bool WM_cursor_test_motion_and_update | ( | const int | mval[2] | ) |
Detect motion between selection (callers should only use this for selection picking), typically mouse press/click events.
mval | Region relative coordinates, call with (-1, -1) resets the last cursor location. |
NOTE(@campbellbarton): The logic used here isn't foolproof. It's possible that users move the cursor past WM_EVENT_CURSOR_MOTION_THRESHOLD then back to a position within the threshold (between mouse clicks). In practice users never reported this since the threshold is very small (a few pixels). To prevent the unlikely case of values matching from another region, changing regions resets this value to (-1, -1).
Definition at line 329 of file wm_event_query.c.
References copy_v2_v2_int(), len_manhattan_v2v2_int(), and WM_EVENT_CURSOR_MOTION_THRESHOLD.
Referenced by ED_screen_set_active_region(), get_nearest_editbonepoint(), mixed_bones_object_selectbuffer_extended(), seq_select_seq_from_preview(), and unified_findnearest().
int WM_event_absolute_delta_x | ( | const struct wmEvent * | event | ) |
Definition at line 552 of file wm_event_query.c.
References wmEvent::flag, and WM_EVENT_SCROLL_INVERT.
Referenced by view_zoomdrag_invoke().
int WM_event_absolute_delta_y | ( | const struct wmEvent * | event | ) |
Definition at line 563 of file wm_event_query.c.
References wmEvent::flag, and WM_EVENT_SCROLL_INVERT.
Referenced by ui_pan_to_scroll(), and view_zoomdrag_invoke().
int WM_event_drag_direction | ( | const wmEvent * | event | ) |
Definition at line 267 of file wm_event_query.c.
References atan2f, KM_DIRECTION_E, KM_DIRECTION_N, KM_DIRECTION_NE, KM_DIRECTION_NW, KM_DIRECTION_S, KM_DIRECTION_SE, KM_DIRECTION_SW, KM_DIRECTION_W, M_PI, and round_fl_to_int().
Referenced by wm_handlers_do().
Definition at line 381 of file wm_event_query.c.
References KM_CLICK_DRAG, wmEvent::prev_press_xy, ARegion::winrct, rcti::xmin, xy, wmEvent::xy, and rcti::ymin.
Referenced by actkeys_box_select_invoke(), graphkeys_box_select_invoke(), initTransform(), initTransInfo(), blender::ed::space_node::is_event_over_node_or_socket(), blender::ed::space_node::node_link_invoke(), blender::ed::space_node::node_resize_invoke(), blender::ed::space_node::node_resize_modal(), outliner_box_select_invoke(), outliner_item_activate_invoke(), outliner_item_drag_drop_invoke(), outliner_item_drag_element_find(), outliner_item_openclose_invoke(), sequencer_box_select_invoke(), view3d_interactive_add_begin(), view3d_ruler_add_invoke(), WM_generic_select_invoke(), and wm_gizmomap_highlight_find().
Definition at line 388 of file wm_event_query.c.
References KM_CLICK_DRAG, wmEvent::prev_press_xy, ARegion::winrct, rcti::xmin, xy, wmEvent::xy, and rcti::ymin.
Referenced by annotation_draw_apply_event(), gizmo_ruler_invoke(), gpencil_primitive_interaction_begin(), and view3d_interactive_add_modal().
Definition at line 395 of file wm_event_query.c.
References copy_v2_v2_int(), KM_CLICK_DRAG, wmEvent::prev_press_xy, wmEvent::val, and wmEvent::xy.
Referenced by ui_list_activate_hovered_row(), ui_list_is_hovering_draggable_but(), and WM_gesture_new().
Definition at line 374 of file wm_event_query.c.
References sub_v2_v2v2_int(), WM_event_drag_test_with_delta(), and wmEvent::xy.
Referenced by curve_pen_modal(), wm_event_is_double_click(), and wm_handlers_do().
Definition at line 368 of file wm_event_query.c.
References blender::math::abs(), and WM_event_drag_threshold().
Referenced by WM_event_drag_test(), and WM_generic_select_modal().
int WM_event_drag_threshold | ( | const struct wmEvent * | event | ) |
Definition at line 346 of file wm_event_query.c.
References BLI_assert, ISMOUSE_BUTTON, MOUSEMOVE, wmEvent::prev_press_type, and WM_event_is_tablet().
Referenced by ui_but_drag_init(), and WM_event_drag_test_with_delta().
bool WM_event_is_modal_drag_exit | ( | const wmEvent * | event, |
const short | init_event_type, | ||
const short | init_event_val | ||
) |
Definition at line 224 of file wm_event_query.c.
References KM_CLICK_DRAG, KM_RELEASE, wmEvent::type, USER_RELEASECONFIRM, and wmEvent::val.
Referenced by ed_marker_move_modal().
Definition at line 256 of file wm_event_query.c.
References ISMOUSE_BUTTON, KM_CLICK_DRAG, wmEvent::type, and wmEvent::val.
Referenced by gizmo_tweak_invoke(), and WM_event_is_mouse_drag_or_press().
Definition at line 261 of file wm_event_query.c.
References ISMOUSE_BUTTON, KM_PRESS, wmEvent::type, and WM_event_is_mouse_drag().
Referenced by WM_gesture_box_invoke(), WM_gesture_circle_invoke(), and WM_gesture_straightline_invoke().
Definition at line 537 of file wm_event_query.c.
References wmTabletData::active, EVT_TABLET_NONE, and wmEvent::tablet.
Referenced by paint_stroke_modal(), and WM_event_drag_threshold().
Definition at line 77 of file wm_event_query.c.
References wmTabletData::active, ARRAY_SIZE, BLI_str_utf8_size(), event_ids_from_flag(), event_ids_from_type_and_value(), EVT_TABLET_NONE, wmEvent::flag, ISNDOF, wmEvent::keymodifier, KM_ALT, KM_CTRL, KM_OSKEY, KM_SHIFT, wmEvent::modifier, NDOF_MOTION, wmTabletData::pressure, wmEvent::prev_type, wmEvent::prev_val, wmEvent::type, UNPACK3, wmEvent::utf8_buf, wmEvent::val, WM_EVENT_FORCE_DRAG_THRESHOLD, WM_EVENT_IS_REPEAT, WM_EVENT_SCROLL_INVERT, wmTabletData::x_tilt, wmEvent::xy, and wmTabletData::y_tilt.
Referenced by wm_event_add_ghostevent(), wm_event_do_handlers(), and wm_event_free().
Definition at line 523 of file wm_event_query.c.
References EVT_TABLET_ERASER.
Referenced by paint_stroke_modal().
bool WM_event_type_mask_test | ( | const int | event_type, |
const enum eEventType_Mask | mask | ||
) |
Definition at line 170 of file wm_event_query.c.
References EVT_TYPE_MASK_ACTIONZONE, EVT_TYPE_MASK_KEYBOARD, EVT_TYPE_MASK_KEYBOARD_MODIFIER, EVT_TYPE_MASK_MOUSE, EVT_TYPE_MASK_MOUSE_GESTURE, EVT_TYPE_MASK_MOUSE_WHEEL, EVT_TYPE_MASK_NDOF, IS_EVENT_ACTIONZONE, ISKEYBOARD, ISKEYMODIFIER, ISMOUSE, ISMOUSE_GESTURE, ISMOUSE_WHEEL, ISNDOF, and mask().
Referenced by kmi_filter_is_visible_type_mask().
char WM_event_utf8_to_ascii | ( | const struct wmEvent * | event | ) |
Definition at line 406 of file wm_event_query.c.
References BLI_str_utf8_size(), and wmEvent::utf8_buf.
Referenced by handleNumInput(), poselib_preview_handle_event(), and text_line_number_invoke().
Applies the global tablet pressure correction curve.
Definition at line 508 of file wm_event_query.c.
Referenced by wm_tablet_data_from_ghost().
int WM_userdef_event_map | ( | int | kmitype | ) |
Event map that takes preferences into account.
Definition at line 420 of file wm_event_query.c.
References USER_WHEELZOOMDIR, WHEELDOWNMOUSE, WHEELINMOUSE, WHEELOUTMOUSE, and WHEELUPMOUSE.
Referenced by wm_eventmatch(), and WM_keymap_item_compare().
int WM_userdef_event_type_from_keymap_type | ( | int | kmitype | ) |
Use so we can check if 'wmEvent.type' is released in modal operators.
An alternative would be to add a 'wmEvent.type_nokeymap'... or similar.
Definition at line 432 of file wm_event_query.c.
References USER_WHEELZOOMDIR, WHEELDOWNMOUSE, WHEELINMOUSE, WHEELOUTMOUSE, and WHEELUPMOUSE.
Referenced by edbm_bevel_invoke(), edbm_inset_invoke(), gizmo_tweak_invoke(), image_view_pan_init(), image_view_zoom_init(), initTransform(), object_transform_axis_target_invoke(), op_generic_value_invoke(), poselib_blend_init_data(), radial_control_invoke(), sample_color_invoke(), slide_plane_marker_customdata(), stencil_control_invoke(), view3d_interactive_add_begin(), view_pan_init(), and view_zoom_init().