|
Blender V4.3
|
#include "WM_api.hh"Go to the source code of this file.
Classes | |
| struct | wmEventHandler |
| struct | wmEventHandler_KeymapPost |
| struct | wmEventHandler_KeymapDynamic |
| struct | wmEventHandler_Keymap |
| struct | wmEventHandler_Gizmo |
| struct | wmEventHandler_UI |
| struct | wmEventHandler_Op |
| struct | wmEventHandler_Dropbox |
Typedefs | |
| using | EventHandlerPoll = bool (*)(const ARegion *region, const wmEvent *event) |
Enumerations | |
| enum | eWM_EventHandlerType { WM_HANDLER_TYPE_GIZMO = 1 , WM_HANDLER_TYPE_UI , WM_HANDLER_TYPE_OP , WM_HANDLER_TYPE_DROPBOX , WM_HANDLER_TYPE_KEYMAP } |
| using EventHandlerPoll = bool (*)(const ARegion *region, const wmEvent *event) |
Definition at line 37 of file wm_event_system.hh.
| enum eWM_EventHandlerType |
Custom types for handlers, for signaling, freeing.
| Enumerator | |
|---|---|
| WM_HANDLER_TYPE_GIZMO | |
| WM_HANDLER_TYPE_UI | |
| WM_HANDLER_TYPE_OP | |
| WM_HANDLER_TYPE_DROPBOX | |
| WM_HANDLER_TYPE_KEYMAP | |
Definition at line 29 of file wm_event_system.hh.
Called in inner handler loop, region context.
Definition at line 569 of file wm_dragdrop.cc.
References wmDragActiveDropState::active_dropbox, BLI_listbase_is_empty(), CTX_wm_manager(), CTX_wm_window(), wmWindowManager::drags, wmDrag::drop_state, LISTBASE_FOREACH, WM_CURSOR_DEFAULT, WM_cursor_modal_set(), WM_CURSOR_STOP, and wm_drop_update_active().
Referenced by wm_event_do_region_handlers().
Called in wm_draw_window_onscreen.
Definition at line 1153 of file wm_dragdrop.cc.
References wmDragActiveDropState::active_dropbox, wmDragActiveDropState::area_from, BKE_screen_find_area_xy(), BLI_assert, CTX_store_set(), CTX_wm_area(), CTX_wm_area_set(), CTX_wm_manager(), CTX_wm_region(), CTX_wm_region_set(), CTX_wm_screen(), wmWindowManager::drags, wmDropBox::draw_droptip, wmDropBox::draw_in_view, wmDrag::drop_state, ED_area_find_region_xy_visual(), ELEM, wmWindow::eventstate, GHOST_kGrabHide, GHOST_kGrabWrap, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, wmWindow::grabcursor, LISTBASE_FOREACH, wmDragActiveDropState::region_from, RGN_TYPE_ANY, SPACE_TYPE_ANY, wmDragActiveDropState::ui_context, wm_cursor_position_get(), wm_drag_draw_default(), wmViewport(), wmWindowViewport(), wmWindowViewport_ex(), wmEvent::xy, and xy.
Referenced by wm_draw_window_onscreen().
| void wm_drags_exit | ( | wmWindowManager * | wm, |
| wmWindow * | win ) |
Additional work to cleanly end dragging. Additional because this doesn't actually remove the drag items. Should be called whenever dragging is stopped (successful or not, also when canceled).
Definition at line 321 of file wm_dragdrop.cc.
References ED_region_tag_redraw_no_rebuild(), wmWindow::eventstate, LISTBASE_FOREACH, wmWindow::tag_cursor_refresh, wmWindowManager::windows, WM_cursor_modal_restore(), WM_event_add_mousemove(), WM_window_find_under_cursor(), WM_window_get_active_screen(), and wmEvent::xy.
Referenced by wm_drop_prepare(), wm_event_drag_and_drop_test(), and wm_handlers_do_intern().
Definition at line 564 of file wm_dragdrop.cc.
References CTX_store_set().
Referenced by wm_handlers_do_intern().
| wmOperatorCallContext wm_drop_operator_context_get | ( | const wmDropBox * | drop | ) |
The operator of a dropbox should always be executed in the context determined by the mouse coordinates. The dropbox poll should check the context area and region as needed. So this always returns WM_OP_INVOKE_DEFAULT.
Definition at line 589 of file wm_dragdrop.cc.
References WM_OP_INVOKE_DEFAULT.
Referenced by dropbox_active(), wm_drop_prepare(), and wm_handlers_do_intern().
Definition at line 546 of file wm_dragdrop.cc.
References wmDropBox::copy, CTX_store_set(), CTX_wm_manager(), CTX_wm_window(), wmDrag::drop_state, wmDropBox::ot, wmDragActiveDropState::ui_context, wm_drags_exit(), wm_drop_operator_context_get(), and WM_operator_poll_context().
Referenced by wm_handlers_do_intern().
| void wm_dropbox_free | ( | ) |
Definition at line 208 of file wm_dragdrop.cc.
References BLI_freelistN(), dropboxes, LISTBASE_FOREACH, and wm_drop_item_free_data().
Referenced by WM_exit_ex().
| void wm_event_add_ghostevent | ( | wmWindowManager * | wm, |
| wmWindow * | win, | ||
| int | type, | ||
| const void * | customdata, | ||
| const uint64_t | event_time_ms ) |
Windows store their own event queues wmWindow.event_queue (no bContext here).
Having both, event and event_state, can be highly confusing to work with, but is necessary for our current event system, so let's clear things up a bit:
Always support accessing the last key press/release. This is set from win->eventstate, so it will always be a valid event type to store in the previous state.
Note that these values are intentionally not set in the win->eventstate, as copying these values only makes sense when win->eventstate->{val/type} would be written to (which only happens for some kinds of events). If this was done it could leave win->eventstate previous and current value set to the same key press/release state which doesn't make sense.
Definition at line 5735 of file wm_event_system.cc.
References ARRAY_SIZE, BLI_assert, BLI_assert_unreachable, BLI_str_utf8_from_unicode(), BLI_str_utf8_size_or_error(), GHOST_TEventButtonData::button, CLOG_ERROR, CLOG_INFO, CLOG_WARN, copy_v2_v2_int(), GHOST_TEventTrackpadData::deltaX, GHOST_TEventTrackpadData::deltaY, e, EVENT_NONE, wmWindow::eventstate, wmWindow::eventstate_prev_press_time_ms, EVT_ESCKEY, EVT_LEFTALTKEY, EVT_LEFTCTRLKEY, EVT_LEFTSHIFTKEY, EVT_OSKEY, EVT_RIGHTALTKEY, EVT_RIGHTCTRLKEY, EVT_RIGHTSHIFTKEY, EVT_UNKNOWNKEY, wmEvent::flag, G, G_FLAG_EVENT_SIMULATE, GHOST_kEventButtonDown, GHOST_kEventButtonUp, GHOST_kEventCursorMove, GHOST_kEventImeComposition, GHOST_kEventImeCompositionEnd, GHOST_kEventImeCompositionStart, GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kEventTrackpad, GHOST_kEventUnknown, GHOST_kEventWheel, GHOST_kEventWindowDeactivate, GHOST_kNumEventTypes, GHOST_kTrackpadEventMagnify, GHOST_kTrackpadEventRotate, GHOST_kTrackpadEventScroll, GHOST_kTrackpadEventSmartMagnify, wmWindow::ime_data, wmWindow::ime_data_is_composing, wmTabletData::is_motion_absolute, GHOST_TEventKeyData::is_repeat, GHOST_TEventTrackpadData::isDirectionInverted, ISKEYBOARD_OR_BUTTON, GHOST_TEventKeyData::key, wmEvent::keymodifier, KM_ALT, KM_CTRL, KM_NOTHING, KM_OSKEY, KM_PRESS, KM_RELEASE, KM_SHIFT, MIDDLEMOUSE, wmEvent::modifier, MOUSEMOVE, MOUSEPAN, MOUSEROTATE, MOUSESMARTZOOM, MOUSEZOOM, NDOF_MOTION, wmEvent::prev_type, wmEvent::prev_val, SET_FLAG_FROM_TEST, GHOST_TEventTrackpadData::subtype, GHOST_TEventButtonData::tablet, GHOST_TEventCursorData::tablet, wmEvent::tablet, wmEvent::type, UNLIKELY, USER_TRACKPAD_SCROLL_DIR_NATURAL, USER_TRACKPAD_SCROLL_DIR_TRADITIONAL, GHOST_TEventKeyData::utf8_buf, wmEvent::utf8_buf, wmEvent::val, WHEELDOWNMOUSE, WHEELUPMOUSE, wmWindowManager::winactive, WINDEACTIVATE, WM_capabilities_flag(), WM_CAPABILITY_TRACKPAD_PHYSICAL_DIRECTION, wm_cursor_position_from_ghost_screen_coords(), wm_event_add(), wm_event_add_mousemove(), wm_event_add_trackpad(), wm_event_cursor_other_windows(), wm_event_is_ignorable_key_press(), WM_EVENT_IS_REPEAT, WM_event_print(), WM_EVENT_SCROLL_INVERT, wm_event_state_update_and_click_set(), wm_event_type_from_ghost_button(), wm_event_type_from_ghost_key(), wm_eventemulation(), WM_IME_COMPOSITE_END, WM_IME_COMPOSITE_EVENT, WM_IME_COMPOSITE_START, WM_LOG_EVENTS, WM_LOG_HANDLERS, wm_stereo3d_mouse_offset_apply(), wm_tablet_data_from_ghost(), GHOST_TEventCursorData::x, GHOST_TEventTrackpadData::x, wmEvent::xy, and GHOST_TEventWheelData::z.
Referenced by ghost_event_proc(), wm_window_update_eventstate_modifiers(), and wm_window_update_eventstate_modifiers_clear().
| void wm_event_do_depsgraph | ( | bContext * | C, |
| bool | is_after_open_file ) |
Definition at line 482 of file wm_event_system.cc.
References BKE_scene_ensure_depsgraph(), BKE_scene_graph_update_tagged(), CTX_data_main(), CTX_wm_manager(), CustomData_MeshMasks_update(), DEG_graph_tag_on_visible_update(), DEG_make_active(), depsgraph, ED_view3d_screen_datamask(), LISTBASE_FOREACH, wmWindowManager::runtime, wmWindowManager::windows, wm_surfaces_do_depsgraph(), WM_window_get_active_scene(), WM_window_get_active_screen(), and WM_window_get_active_view_layer().
Referenced by wm_event_do_refresh_wm_and_depsgraph(), and wm_file_read_post().
| void wm_event_do_handlers | ( | bContext * | C | ) |
Goes over entire hierarchy: events -> window -> screen -> area -> region.
Definition at line 4002 of file wm_event_system.cc.
References wmWindow::addmousemove, area_event_inside(), AREA_FLAG_ACTIONZONES_UPDATE, BKE_scene_get_depsgraph(), BKE_sound_scene_playing(), BKE_sound_sync_scene(), BLI_assert, BLI_remlink(), CLOG_INFO, copy_v2_v2_int(), CTX_data_main(), CTX_data_scene(), CTX_data_scene_set(), CTX_wm_area_set(), CTX_wm_manager(), CTX_wm_region_set(), CTX_wm_screen(), CTX_wm_screen_set(), CTX_wm_window(), CTX_wm_window_set(), wmEvent::customdata, DEG_get_evaluated_scene(), depsgraph, ED_area_azones_update(), ED_screen_animation_play(), ED_screen_animation_playing(), ED_screen_areas_iter, ED_screen_set_active_region(), ED_undo_is_state_valid(), ED_update_for_newframe(), wmWindow::event_queue, wmWindow::event_queue_check_click, wmWindow::event_queue_check_drag, wmWindow::event_queue_check_drag_handled, wmWindow::event_queue_consecutive_gesture_type, wmWindow::event_queue_consecutive_gesture_xy, wmWindow::eventstate, EVT_XR_ACTION, ListBase::first, wmEvent::flag, FPS, G, G_DEBUG_EVENTS, G_DEBUG_HANDLERS, GPU_render_begin(), GPU_render_end(), wmWindow::handlers, Scene::id, ID_RECALC_FRAME_CHANGE, ISKEYBOARD_OR_BUTTON, ISMOUSE_BUTTON, ISMOUSE_MOTION, KM_NOTHING, KM_PRESS, len_manhattan_v2v2_int(), LISTBASE_FOREACH, wmWindow::modalhandlers, MOUSEMOVE, NC_WINDOW, NDOF_MOTION, wmEvent::prev_press_type, wmEvent::prev_xy, printf, ID::recalc, region_event_inside(), TIMER, wmEvent::type, wmEvent::val, wmWindowManager::windows, wm_action_not_handled(), wm_event_add(), wm_event_add_mousemove_to_head(), WM_event_add_notifier(), WM_event_consecutive_data_free(), WM_event_consecutive_gesture_test(), WM_event_consecutive_gesture_test_break(), WM_EVENT_CURSOR_MOTION_THRESHOLD, wm_event_do_handlers_area_regions(), wm_event_drag_and_drop_test(), WM_EVENT_FORCE_DRAG_THRESHOLD, wm_event_free_all(), wm_event_free_and_remove_from_queue_if_valid(), wm_event_free_last_handled(), wm_event_inside_rect(), WM_EVENT_IS_CONSECUTIVE, WM_EVENT_IS_REPEAT, wm_event_pie_filter(), WM_event_print(), WM_gizmoconfig_update(), WM_HANDLER_CONTINUE, wm_handlers_do(), WM_keyconfig_update(), WM_LOG_HANDLERS, wm_paintcursor_test(), wm_region_mouse_co(), wm_region_tag_draw_on_gizmo_delay_refresh_for_tweak(), WM_tooltip_clear(), WM_tooltip_init(), WM_window_get_active_scene(), WM_window_get_active_screen(), WM_window_get_active_view_layer(), WM_window_get_active_workspace(), wm_window_make_drawable(), and wmEvent::xy.
Referenced by ghost_event_proc(), and WM_main().
| void wm_event_do_notifiers | ( | bContext * | C | ) |
Called in main-loop.
Definition at line 560 of file wm_event_system.cc.
References BKE_workspace_layout_screen_get(), BLI_assert, BLI_gset_remove(), BLI_pophead(), BLI_remlink(), CTX_data_depsgraph_pointer(), CTX_data_main(), CTX_data_view_layer(), CTX_wm_manager(), CTX_wm_window_set(), depsgraph, ED_area_do_listen(), ED_info_stats_clear(), ED_preview_restart_queue_work(), ED_region_do_listen(), ED_screen_areas_iter, ED_screen_change(), ED_screen_do_listen(), ED_update_for_newframe(), ED_workspace_delete(), ED_workspace_do_listen(), ED_workspace_layout_delete(), ELEM, wmWindowManager::file_saved, ListBase::first, G, G_DEBUG_EVENTS, GPU_render_begin(), GPU_render_end(), LISTBASE_FOREACH, MEM_freeN(), wmWindowManager::message_bus, NC_GEOM, NC_OBJECT, NC_SCENE, NC_SCREEN, NC_SPACE, NC_WM, ND_DATACHANGED, ND_FILEREAD, ND_FILESAVE, ND_FRAME, ND_LAYOUTBROWSE, ND_LAYOUTDELETE, ND_SPACE_INFO, ND_UNDO, ND_WORKSPACE_DELETE, ND_WORKSPACE_SET, wmNotifier::next, wmWindowManager::notifier_current, wmWindowManager::notifier_queue, wmWindowManager::notifier_queue_set, printf, RE_FreeUnusedGPUResources(), scene, wmWindow::scene, UI_popup_handlers_remove_all(), UNUSED_VARS_NDEBUG, wmWindowManager::winactive, wmRegionListenerParams::window, wmSpaceTypeListenerParams::window, wmWindowManager::windows, WM_event_add_notifier(), wm_event_do_refresh_wm_and_depsgraph(), wm_event_timers_execute(), WM_msgbus_handle(), wm_notifier_is_clear(), wm_test_autorun_warning(), wm_test_gpu_backend_fallback(), wm_test_opengl_deprecation_warning(), WM_window_cursor_keymap_status_refresh(), WM_window_get_active_layout(), WM_window_get_active_scene(), WM_window_get_active_screen(), WM_window_get_active_workspace(), WM_window_set_active_workspace(), and WM_window_title().
Referenced by ghost_event_proc(), and WM_main().
| void wm_event_do_refresh_wm_and_depsgraph | ( | bContext * | C | ) |
Was part of wm_event_do_notifiers, split out so it can be called once before entering the WM_main loop. This ensures operators don't run before the UI and depsgraph are initialized.
Definition at line 524 of file wm_event_system.cc.
References CTX_wm_area_set(), CTX_wm_manager(), CTX_wm_window_set(), ED_area_do_refresh(), LISTBASE_FOREACH, wmWindowManager::windows, wm_event_do_depsgraph(), and WM_window_get_active_screen().
Referenced by redraw_timer_step(), wm_event_do_notifiers(), and WM_main().
| void wm_event_free | ( | wmEvent * | event | ) |
Definition at line 249 of file wm_event_system.cc.
References wmEvent::flag, ISKEYBOARD, ISMOUSE_MOTION, KM_NOTHING, MEM_freeN(), printf, wmEvent::type, wmEvent::val, wm_event_custom_free(), WM_EVENT_IS_REPEAT, and WM_event_print().
Referenced by wm_event_free_all(), wm_event_free_and_remove_from_queue_if_valid(), wm_event_free_last(), and wm_event_free_last_handled().
| void wm_event_free_all | ( | wmWindow * | win | ) |
Definition at line 306 of file wm_event_system.cc.
References BLI_pophead(), wmWindow::event_queue, and wm_event_free().
Referenced by wm_event_do_handlers(), and wm_window_free().
| void wm_event_free_handler | ( | wmEventHandler * | handler | ) |
Definition at line 2116 of file wm_event_system.cc.
References MEM_freeN().
Referenced by WM_event_free_ui_handler_all(), WM_event_remove_area_handler(), WM_event_remove_handlers(), WM_event_remove_keymap_handler(), WM_event_remove_model_handler(), WM_event_remove_ui_handler(), wm_handler_fileselect_do(), wm_handler_operator_call(), wm_handlers_do_intern(), and wm_macro_modal().
| void wm_event_handler_ui_cancel_ex | ( | bContext * | C, |
| wmWindow * | win, | ||
| ARegion * | region, | ||
| bool | reactivate_button ) |
Definition at line 922 of file wm_event_system.cc.
References BLI_assert, EVT_BUT_CANCEL, wmEventHandler_UI::handle_fn, KM_NOTHING, KM_PRESS, LISTBASE_FOREACH_MUTABLE, wmEventHandler_UI::user_data, wm_event_init_from_window(), and WM_HANDLER_TYPE_UI.
Referenced by UI_context_active_but_clear(), and wm_event_handler_ui_cancel().
Applies the global tablet pressure correction curve.
Definition at line 544 of file wm_event_query.cc.
Referenced by wm_tablet_data_from_ghost().
| void wm_tablet_data_from_ghost | ( | const GHOST_TabletData * | tablet_data, |
| wmTabletData * | wmtab ) |
Definition at line 5424 of file wm_event_system.cc.
References GHOST_TabletData::Active, wmTabletData::active, GHOST_kTabletModeNone, int, wmTabletData::is_motion_absolute, GHOST_TabletData::Pressure, wmTabletData::pressure, wm_event_tablet_data_default(), wm_pressure_curve(), wmTabletData::x_tilt, GHOST_TabletData::Xtilt, wmTabletData::y_tilt, and GHOST_TabletData::Ytilt.
Referenced by wm_event_add_ghostevent().