Blender  V3.3
Classes | Macros
wm_keymap.c File Reference
#include <string.h>
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLF_api.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
#include "BKE_screen.h"
#include "BKE_workspace.h"
#include "BLT_translation.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
#include "wm_event_system.h"
#include "wm_event_types.h"

Go to the source code of this file.

Classes

struct  wmKeyMapItemFind_Params
 

Macros

#define ADD_SEP
 

Functions

Keymap Item

Item in a keymap, that maps from an event to an operator or modal map item.

static wmKeyMapItemwm_keymap_item_copy (wmKeyMapItem *kmi)
 
static void wm_keymap_item_free (wmKeyMapItem *kmi)
 
static void wm_keymap_item_properties_set (wmKeyMapItem *kmi)
 
static void wm_keymap_item_properties_update_ot (wmKeyMapItem *kmi)
 
static void wm_keymap_item_properties_update_ot_from_list (ListBase *km_lb)
 
static bool wm_keymap_item_equals_result (wmKeyMapItem *a, wmKeyMapItem *b)
 
static bool wm_keymap_item_equals (wmKeyMapItem *a, wmKeyMapItem *b)
 
void WM_keymap_item_properties_reset (wmKeyMapItem *kmi, struct IDProperty *properties)
 
int WM_keymap_item_map_type_get (const wmKeyMapItem *kmi)
 
Keymap Diff Item

Item in a diff keymap, used for saving diff of keymaps in user preferences.

static wmKeyMapDiffItemwm_keymap_diff_item_copy (wmKeyMapDiffItem *kmdi)
 
static void wm_keymap_diff_item_free (wmKeyMapDiffItem *kmdi)
 
Key Configuration

List of keymaps for all editors, modes, etc. There is a builtin default key configuration, a user key configuration, and other preset configurations.

wmKeyConfigWM_keyconfig_new (wmWindowManager *wm, const char *idname, bool user_defined)
 
wmKeyConfigWM_keyconfig_new_user (wmWindowManager *wm, const char *idname)
 
bool WM_keyconfig_remove (wmWindowManager *wm, wmKeyConfig *keyconf)
 
void WM_keyconfig_clear (wmKeyConfig *keyconf)
 
void WM_keyconfig_free (wmKeyConfig *keyconf)
 
static wmKeyConfigWM_keyconfig_active (wmWindowManager *wm)
 
void WM_keyconfig_set_active (wmWindowManager *wm, const char *idname)
 
Keymap

List of keymap items for one editor, mode, modal operator.

static wmKeyMapwm_keymap_new (const char *idname, int spaceid, int regionid)
 
static wmKeyMapwm_keymap_copy (wmKeyMap *keymap)
 
void WM_keymap_clear (wmKeyMap *keymap)
 
bool WM_keymap_remove (wmKeyConfig *keyconf, wmKeyMap *keymap)
 
bool WM_keymap_poll (bContext *C, wmKeyMap *keymap)
 
static void keymap_event_set (wmKeyMapItem *kmi, const KeyMapItem_Params *params)
 
static void keymap_item_set_id (wmKeyMap *keymap, wmKeyMapItem *kmi)
 
wmKeyMapItemWM_keymap_add_item (wmKeyMap *keymap, const char *idname, const KeyMapItem_Params *params)
 
wmKeyMapItemWM_keymap_add_item_copy (struct wmKeyMap *keymap, wmKeyMapItem *kmi_src)
 
bool WM_keymap_remove_item (wmKeyMap *keymap, wmKeyMapItem *kmi)
 
Keymap Diff and Patch

Rather than saving the entire keymap for user preferences, we only save a diff so that changes in the defaults get synced. This system is not perfect but works better than overriding the keymap entirely when only few items are changed.

static void wm_keymap_addon_add (wmKeyMap *keymap, wmKeyMap *addonmap)
 
static wmKeyMapItemwm_keymap_find_item_equals (wmKeyMap *km, wmKeyMapItem *needle)
 
static wmKeyMapItemwm_keymap_find_item_equals_result (wmKeyMap *km, wmKeyMapItem *needle)
 
static void wm_keymap_diff (wmKeyMap *diff_km, wmKeyMap *from_km, wmKeyMap *to_km, wmKeyMap *orig_km, wmKeyMap *addon_km)
 
static void wm_keymap_patch (wmKeyMap *km, wmKeyMap *diff_km)
 
static wmKeyMapwm_keymap_patch_update (ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *addonmap, wmKeyMap *usermap)
 
static void wm_keymap_diff_update (ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *addonmap, wmKeyMap *km)
 
Storage in WM

Name id's are for storing general or multiple keymaps.

wmKeyMapWM_keymap_list_find (ListBase *lb, const char *idname, int spaceid, int regionid)
 
wmKeyMapWM_keymap_list_find_spaceid_or_empty (ListBase *lb, const char *idname, int spaceid, int regionid)
 
wmKeyMapWM_keymap_ensure (wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
 
wmKeyMapWM_keymap_find_all (wmWindowManager *wm, const char *idname, int spaceid, int regionid)
 
wmKeyMapWM_keymap_find_all_spaceid_or_empty (wmWindowManager *wm, const char *idname, int spaceid, int regionid)
 
Modal Keymaps

Modal key-maps get linked to a running operator, and filter the keys before sending to wmOperatorType.modal callback.

wmKeyMapWM_modalkeymap_ensure (wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
 
wmKeyMapWM_modalkeymap_find (wmKeyConfig *keyconf, const char *idname)
 
wmKeyMapItemWM_modalkeymap_add_item (wmKeyMap *km, const KeyMapItem_Params *params, int value)
 
wmKeyMapItemWM_modalkeymap_add_item_str (wmKeyMap *km, const KeyMapItem_Params *params, const char *value)
 
static const wmKeyMapItemwm_modalkeymap_find_propvalue_iter (const wmKeyMap *km, const wmKeyMapItem *kmi, const int propvalue)
 
const wmKeyMapItemWM_modalkeymap_find_propvalue (const wmKeyMap *km, const int propvalue)
 
void WM_modalkeymap_assign (wmKeyMap *km, const char *opname)
 
static void wm_user_modal_keymap_set_items (wmWindowManager *wm, wmKeyMap *km)
 
Text from Key Events
static const char * key_event_glyph_or_text (const int font_id, const char *text, const char *single_glyph)
 
const char * WM_key_event_string (const short type, const bool compact)
 
int WM_keymap_item_raw_to_string (const short shift, const short ctrl, const short alt, const short oskey, const short keymodifier, const short val, const short type, const bool compact, char *result, const int result_len)
 
int WM_keymap_item_to_string (const wmKeyMapItem *kmi, const bool compact, char *result, const int result_len)
 
int WM_modalkeymap_items_to_string (const wmKeyMap *km, const int propvalue, const bool compact, char *result, const int result_len)
 
int WM_modalkeymap_operator_items_to_string (wmOperatorType *ot, const int propvalue, const bool compact, char *result, const int result_len)
 
char * WM_modalkeymap_operator_items_to_string_buf (wmOperatorType *ot, const int propvalue, const bool compact, const int max_len, int *r_available_len, char **r_result)
 
Keymap Finding Utilities
static wmKeyMapItemwm_keymap_item_find_in_keymap (wmKeyMap *keymap, const char *opname, IDProperty *properties, const bool is_strict, const struct wmKeyMapItemFind_Params *params)
 
static wmKeyMapItemwm_keymap_item_find_handlers (const bContext *C, wmWindowManager *wm, wmWindow *win, ListBase *handlers, const char *opname, wmOperatorCallContext UNUSED(opcontext), IDProperty *properties, const bool is_strict, const struct wmKeyMapItemFind_Params *params, wmKeyMap **r_keymap)
 
static wmKeyMapItemwm_keymap_item_find_props (const bContext *C, const char *opname, wmOperatorCallContext opcontext, IDProperty *properties, const bool is_strict, const struct wmKeyMapItemFind_Params *params, wmKeyMap **r_keymap)
 
static wmKeyMapItemwm_keymap_item_find (const bContext *C, const char *opname, wmOperatorCallContext opcontext, IDProperty *properties, bool is_strict, const struct wmKeyMapItemFind_Params *params, wmKeyMap **r_keymap)
 
static bool kmi_filter_is_visible (const wmKeyMap *UNUSED(km), const wmKeyMapItem *kmi, void *UNUSED(user_data))
 
char * WM_key_event_operator_string (const bContext *C, const char *opname, wmOperatorCallContext opcontext, IDProperty *properties, const bool is_strict, char *result, const int result_len)
 
static bool kmi_filter_is_visible_type_mask (const wmKeyMap *km, const wmKeyMapItem *kmi, void *user_data)
 
wmKeyMapItemWM_key_event_operator (const bContext *C, const char *opname, wmOperatorCallContext opcontext, IDProperty *properties, const short include_mask, const short exclude_mask, wmKeyMap **r_keymap)
 
wmKeyMapItemWM_key_event_operator_from_keymap (wmKeyMap *keymap, const char *opname, IDProperty *properties, const short include_mask, const short exclude_mask)
 
bool WM_keymap_item_compare (const wmKeyMapItem *k1, const wmKeyMapItem *k2)
 
Event Handling

Handlers have pointers to the keymap in the default configuration. During event handling this function is called to get the keymap from the final configuration.

wmKeyMapWM_keymap_active (const wmWindowManager *wm, wmKeyMap *keymap)
 
Keymap Editor

In the keymap editor the user key configuration is edited.

void WM_keymap_item_restore_to_default (wmWindowManager *wm, wmKeyMap *keymap, wmKeyMapItem *kmi)
 
void WM_keymap_restore_to_default (wmKeyMap *keymap, wmWindowManager *wm)
 
wmKeyMapItemWM_keymap_item_find_id (wmKeyMap *keymap, int id)
 
const char * WM_bool_as_string (bool test)
 

Update Final Configuration

On load or other changes, the final user key configuration is rebuilt from the preset, add-on and user preferences keymaps. We also test if the final configuration changed and write the changes to the user preferences.

enum  { WM_KEYMAP_UPDATE_RECONFIGURE = (1 << 0) , WM_KEYMAP_UPDATE_OPERATORTYPE = (1 << 1) }
 
static char wm_keymap_update_flag = 0
 
void WM_keyconfig_update_tag (wmKeyMap *keymap, wmKeyMapItem *kmi)
 
void WM_keyconfig_update_operatortype (void)
 
static bool wm_keymap_test_and_clear_update (wmKeyMap *km)
 
static wmKeyMapwm_keymap_preset (wmWindowManager *wm, wmKeyMap *km)
 
void WM_keyconfig_update (wmWindowManager *wm)
 

Detailed Description

Configurable key-maps - add/remove/find/compare/patch...

Definition in file wm_keymap.c.

Macro Definition Documentation

◆ ADD_SEP

#define ADD_SEP
Value:
if (p != buf) { \
*p++ = ' '; \
} \
(void)0
SyclQueue void void size_t num_bytes void

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
WM_KEYMAP_UPDATE_RECONFIGURE 
WM_KEYMAP_UPDATE_OPERATORTYPE 

Definition at line 1778 of file wm_keymap.c.

Function Documentation

◆ key_event_glyph_or_text()

static const char* key_event_glyph_or_text ( const int  font_id,
const char *  text,
const char *  single_glyph 
)
static

Definition at line 1036 of file wm_keymap.c.

References BLF_has_glyph(), BLI_assert, BLI_str_utf8_as_unicode(), BLI_strlen_utf8(), and NULL.

Referenced by WM_key_event_string().

◆ keymap_event_set()

static void keymap_event_set ( wmKeyMapItem kmi,
const KeyMapItem_Params params 
)
static

◆ keymap_item_set_id()

static void keymap_item_set_id ( wmKeyMap keymap,
wmKeyMapItem kmi 
)
static

◆ kmi_filter_is_visible()

static bool kmi_filter_is_visible ( const wmKeyMap UNUSEDkm,
const wmKeyMapItem kmi,
void UNUSEDuser_data 
)
static

◆ kmi_filter_is_visible_type_mask()

static bool kmi_filter_is_visible_type_mask ( const wmKeyMap km,
const wmKeyMapItem kmi,
void user_data 
)
static

◆ WM_bool_as_string()

const char* WM_bool_as_string ( bool  test)

◆ WM_key_event_operator()

wmKeyMapItem* WM_key_event_operator ( const bContext C,
const char *  opname,
wmOperatorCallContext  opcontext,
IDProperty properties,
const short  include_mask,
const short  exclude_mask,
wmKeyMap **  r_keymap 
)

◆ WM_key_event_operator_from_keymap()

wmKeyMapItem* WM_key_event_operator_from_keymap ( wmKeyMap keymap,
const char *  opname,
IDProperty properties,
const short  include_mask,
const short  exclude_mask 
)

◆ WM_key_event_operator_string()

char* WM_key_event_operator_string ( const bContext C,
const char *  opname,
wmOperatorCallContext  opcontext,
IDProperty properties,
const bool  is_strict,
char *  result,
const int  result_len 
)

◆ WM_key_event_string()

const char* WM_key_event_string ( const short  type,
const bool  compact 
)

◆ WM_keyconfig_active()

static wmKeyConfig* WM_keyconfig_active ( wmWindowManager wm)
static

◆ WM_keyconfig_clear()

void WM_keyconfig_clear ( wmKeyConfig keyconf)

◆ WM_keyconfig_free()

void WM_keyconfig_free ( wmKeyConfig keyconf)

Definition at line 321 of file wm_keymap.c.

References MEM_freeN, and WM_keyconfig_clear().

Referenced by wm_close_and_free(), and WM_keyconfig_remove().

◆ WM_keyconfig_new()

wmKeyConfig* WM_keyconfig_new ( wmWindowManager wm,
const char *  idname,
bool  user_defined 
)

◆ WM_keyconfig_new_user()

wmKeyConfig* WM_keyconfig_new_user ( wmWindowManager wm,
const char *  idname 
)

Definition at line 290 of file wm_keymap.c.

References WM_keyconfig_new().

◆ WM_keyconfig_remove()

bool WM_keyconfig_remove ( wmWindowManager wm,
wmKeyConfig keyconf 
)

◆ WM_keyconfig_set_active()

void WM_keyconfig_set_active ( wmWindowManager wm,
const char *  idname 
)

◆ WM_keyconfig_update()

void WM_keyconfig_update ( wmWindowManager wm)

◆ WM_keyconfig_update_operatortype()

void WM_keyconfig_update_operatortype ( void  )

Definition at line 1800 of file wm_keymap.c.

References wm_keymap_update_flag, and WM_KEYMAP_UPDATE_OPERATORTYPE.

Referenced by WM_operatortype_remove_ptr().

◆ WM_keyconfig_update_tag()

void WM_keyconfig_update_tag ( wmKeyMap keymap,
wmKeyMapItem kmi 
)

◆ WM_keymap_active()

wmKeyMap* WM_keymap_active ( const wmWindowManager wm,
wmKeyMap keymap 
)

◆ WM_keymap_add_item()

wmKeyMapItem* WM_keymap_add_item ( struct wmKeyMap keymap,
const char *  idname,
const KeyMapItem_Params params 
)

◆ WM_keymap_add_item_copy()

wmKeyMapItem* WM_keymap_add_item_copy ( struct wmKeyMap keymap,
wmKeyMapItem kmi_src 
)

◆ wm_keymap_addon_add()

static void wm_keymap_addon_add ( wmKeyMap keymap,
wmKeyMap addonmap 
)
static

◆ WM_keymap_clear()

void WM_keymap_clear ( wmKeyMap keymap)

◆ wm_keymap_copy()

static wmKeyMap* wm_keymap_copy ( wmKeyMap keymap)
static

◆ wm_keymap_diff()

static void wm_keymap_diff ( wmKeyMap diff_km,
wmKeyMap from_km,
wmKeyMap to_km,
wmKeyMap orig_km,
wmKeyMap addon_km 
)
static

◆ wm_keymap_diff_item_copy()

static wmKeyMapDiffItem* wm_keymap_diff_item_copy ( wmKeyMapDiffItem kmdi)
static

◆ wm_keymap_diff_item_free()

static void wm_keymap_diff_item_free ( wmKeyMapDiffItem kmdi)
static

◆ wm_keymap_diff_update()

static void wm_keymap_diff_update ( ListBase lb,
wmKeyMap defaultmap,
wmKeyMap addonmap,
wmKeyMap km 
)
static

◆ WM_keymap_ensure()

wmKeyMap* WM_keymap_ensure ( wmKeyConfig keyconf,
const char *  idname,
int  spaceid,
int  regionid 
)

Definition at line 852 of file wm_keymap.c.

References BLI_addtail(), wmKeyConfig::keymaps, NULL, WM_keyconfig_update_tag(), WM_keymap_list_find(), and wm_keymap_new().

Referenced by action_buttons_area_init(), action_channel_region_init(), action_keymap(), action_main_region_init(), buttons_keymap(), buttons_main_region_init(), clip_channels_region_init(), clip_keymap(), clip_main_region_init(), clip_preview_region_init(), clip_properties_region_init(), clip_tools_region_init(), console_keymap(), console_main_region_init(), ed_default_handlers(), ED_keymap_anim(), ED_keymap_animchannels(), ED_keymap_armature(), ED_keymap_curve(), ed_keymap_gpencil_curve_editing(), ed_keymap_gpencil_editing(), ed_keymap_gpencil_general(), ed_keymap_gpencil_painting(), ed_keymap_gpencil_painting_draw(), ed_keymap_gpencil_painting_erase(), ed_keymap_gpencil_painting_fill(), ed_keymap_gpencil_painting_tint(), ed_keymap_gpencil_sculpting(), ed_keymap_gpencil_sculptpainting_clone(), ed_keymap_gpencil_sculptpainting_grab(), ed_keymap_gpencil_sculptpainting_pinch(), ed_keymap_gpencil_sculptpainting_push(), ed_keymap_gpencil_sculptpainting_randomize(), ed_keymap_gpencil_sculptpainting_smooth(), ed_keymap_gpencil_sculptpainting_strength(), ed_keymap_gpencil_sculptpainting_thickness(), ed_keymap_gpencil_sculptpainting_twist(), ed_keymap_gpencil_vertexpainting(), ed_keymap_gpencil_vertexpainting_average(), ed_keymap_gpencil_vertexpainting_blur(), ed_keymap_gpencil_vertexpainting_draw(), ed_keymap_gpencil_vertexpainting_replace(), ed_keymap_gpencil_vertexpainting_smear(), ed_keymap_gpencil_weightpainting(), ed_keymap_gpencil_weightpainting_draw(), ED_keymap_lattice(), ED_keymap_marker(), ED_keymap_mask(), ED_keymap_mesh(), ED_keymap_metaball(), ED_keymap_object(), ED_keymap_paint(), ED_keymap_screen(), ED_keymap_ui(), ED_keymap_uvedit(), ED_keymap_view2d(), ED_region_panels_init(), file_execution_region_init(), file_header_region_init(), file_keymap(), file_main_region_init(), file_tools_region_init(), file_ui_region_init(), graph_buttons_region_init(), graph_channel_region_init(), graph_main_region_init(), graphedit_keymap(), image_buttons_region_init(), image_keymap(), image_main_region_init(), image_tools_region_init(), info_keymap(), info_main_region_init(), keymap_particle(), nla_buttons_region_init(), nla_channel_region_init(), nla_keymap(), nla_main_region_init(), blender::ed::space_node::node_buttons_region_init(), blender::ed::space_node::node_keymap(), blender::ed::space_node::node_main_region_init(), blender::ed::space_node::node_toolbar_region_init(), outliner_keymap(), outliner_main_region_init(), script_main_region_init(), sequencer_buttons_region_init(), sequencer_channel_region_init(), sequencer_keymap(), sequencer_main_region_init(), sequencer_preview_region_init(), sequencer_tools_region_init(), spreadsheet_keymap(), spreadsheet_main_region_init(), spreadsheet_sidebar_init(), text_keymap(), text_main_region_init(), text_properties_region_init(), tool_generic_create_gizmo(), topbar_main_region_init(), view3d_buttons_region_init(), view3d_header_region_init(), view3d_keymap(), view3d_main_region_init(), view3d_tools_region_init(), WM_gizmo_keymap_generic_click_drag_with_keyconfig(), WM_gizmo_keymap_generic_drag_with_keyconfig(), WM_gizmo_keymap_generic_maybe_drag_with_keyconfig(), WM_gizmo_keymap_generic_select_with_keyconfig(), WM_gizmo_keymap_generic_with_keyconfig(), WM_gizmogroup_keymap_template_select_ex(), WM_modalkeymap_ensure(), wm_window_ghostwindow_ensure(), and wm_window_keymap().

◆ WM_keymap_find_all()

wmKeyMap* WM_keymap_find_all ( wmWindowManager wm,
const char *  idname,
int  spaceid,
int  regionid 
)

◆ WM_keymap_find_all_spaceid_or_empty()

wmKeyMap* WM_keymap_find_all_spaceid_or_empty ( wmWindowManager wm,
const char *  idname,
int  spaceid,
int  regionid 
)

◆ wm_keymap_find_item_equals()

static wmKeyMapItem* wm_keymap_find_item_equals ( wmKeyMap km,
wmKeyMapItem needle 
)
static

◆ wm_keymap_find_item_equals_result()

static wmKeyMapItem* wm_keymap_find_item_equals_result ( wmKeyMap km,
wmKeyMapItem needle 
)
static

◆ WM_keymap_item_compare()

bool WM_keymap_item_compare ( const wmKeyMapItem k1,
const wmKeyMapItem k2 
)

◆ wm_keymap_item_copy()

static wmKeyMapItem* wm_keymap_item_copy ( wmKeyMapItem kmi)
static

◆ wm_keymap_item_equals()

static bool wm_keymap_item_equals ( wmKeyMapItem a,
wmKeyMapItem b 
)
static

◆ wm_keymap_item_equals_result()

static bool wm_keymap_item_equals_result ( wmKeyMapItem a,
wmKeyMapItem b 
)
static

◆ wm_keymap_item_find()

static wmKeyMapItem* wm_keymap_item_find ( const bContext C,
const char *  opname,
wmOperatorCallContext  opcontext,
IDProperty properties,
bool  is_strict,
const struct wmKeyMapItemFind_Params params,
wmKeyMap **  r_keymap 
)
static

◆ wm_keymap_item_find_handlers()

static wmKeyMapItem* wm_keymap_item_find_handlers ( const bContext C,
wmWindowManager wm,
wmWindow win,
ListBase handlers,
const char *  opname,
wmOperatorCallContext   UNUSEDopcontext,
IDProperty properties,
const bool  is_strict,
const struct wmKeyMapItemFind_Params params,
wmKeyMap **  r_keymap 
)
static

◆ WM_keymap_item_find_id()

wmKeyMapItem* WM_keymap_item_find_id ( wmKeyMap keymap,
int  id 
)

◆ wm_keymap_item_find_in_keymap()

static wmKeyMapItem* wm_keymap_item_find_in_keymap ( wmKeyMap keymap,
const char *  opname,
IDProperty properties,
const bool  is_strict,
const struct wmKeyMapItemFind_Params params 
)
static

◆ wm_keymap_item_find_props()

static wmKeyMapItem* wm_keymap_item_find_props ( const bContext C,
const char *  opname,
wmOperatorCallContext  opcontext,
IDProperty properties,
const bool  is_strict,
const struct wmKeyMapItemFind_Params params,
wmKeyMap **  r_keymap 
)
static

◆ wm_keymap_item_free()

static void wm_keymap_item_free ( wmKeyMapItem kmi)
static

◆ WM_keymap_item_map_type_get()

int WM_keymap_item_map_type_get ( const wmKeyMapItem kmi)

◆ WM_keymap_item_properties_reset()

void WM_keymap_item_properties_reset ( struct wmKeyMapItem kmi,
struct IDProperty properties 
)

Properties can be NULL, otherwise the arg passed is used and ownership is given to the kmi.

Definition at line 177 of file wm_keymap.c.

References LIKELY, MEM_freeN, NULL, wmKeyMapItem::properties, wmKeyMapItem::ptr, wm_keymap_item_properties_set(), and WM_operator_properties_free().

Referenced by menu_add_shortcut(), and WM_keymap_item_restore_to_default().

◆ wm_keymap_item_properties_set()

static void wm_keymap_item_properties_set ( wmKeyMapItem kmi)
static

◆ wm_keymap_item_properties_update_ot()

static void wm_keymap_item_properties_update_ot ( wmKeyMapItem kmi)
static

◆ wm_keymap_item_properties_update_ot_from_list()

static void wm_keymap_item_properties_update_ot_from_list ( ListBase km_lb)
static

Definition at line 141 of file wm_keymap.c.

References LISTBASE_FOREACH, and wm_keymap_item_properties_update_ot().

Referenced by WM_keyconfig_update().

◆ WM_keymap_item_raw_to_string()

int WM_keymap_item_raw_to_string ( const short  shift,
const short  ctrl,
const short  alt,
const short  oskey,
const short  keymodifier,
const short  val,
const short  type,
const bool  compact,
char *  result,
const int  result_len 
)

◆ WM_keymap_item_restore_to_default()

void WM_keymap_item_restore_to_default ( wmWindowManager wm,
wmKeyMap keymap,
wmKeyMapItem kmi 
)

◆ WM_keymap_item_to_string()

int WM_keymap_item_to_string ( const wmKeyMapItem kmi,
const bool  compact,
char *  result,
const int  result_len 
)

◆ WM_keymap_list_find()

wmKeyMap* WM_keymap_list_find ( ListBase lb,
const char *  idname,
int  spaceid,
int  regionid 
)

◆ WM_keymap_list_find_spaceid_or_empty()

wmKeyMap* WM_keymap_list_find_spaceid_or_empty ( ListBase lb,
const char *  idname,
int  spaceid,
int  regionid 
)

◆ wm_keymap_new()

static wmKeyMap* wm_keymap_new ( const char *  idname,
int  spaceid,
int  regionid 
)
static

◆ wm_keymap_patch()

static void wm_keymap_patch ( wmKeyMap km,
wmKeyMap diff_km 
)
static

If kmi_add is same as kmi_remove (can happen in some cases, typically when we got kmi_remove from wm_keymap_find_item_equals_result()), no need to add or remove anything, see T45579.

Note
This typically happens when we apply user-defined keymap diff to a base one that was exported with that customized keymap already. In that case:
  • wm_keymap_find_item_equals(km, kmdi->remove_item) finds nothing (because actual shortcut of current base does not match kmdi->remove_item any more).
  • wm_keymap_find_item_equals_result(km, kmdi->remove_item) finds the current kmi from base keymap (because it does exactly the same thing).
  • wm_keymap_find_item_equals(km, kmdi->add_item) finds the same kmi, since base keymap was exported with that user-defined shortcut already!
    Maybe we should rather keep user-defined keymaps specific to a given base one? 
    

Definition at line 639 of file wm_keymap.c.

References BLI_addtail(), BLI_freelinkN(), BLI_insertlinkbefore(), wmKeyMap::diff_items, wmKeyMapItem::flag, wmKeyMapItem::id, wmKeyMap::items, keymap_item_set_id(), KMI_EXPANDED, KMI_USER_MODIFIED, LISTBASE_FOREACH, NULL, wm_keymap_find_item_equals(), wm_keymap_find_item_equals_result(), wm_keymap_item_copy(), and wm_keymap_item_free().

Referenced by wm_keymap_patch_update().

◆ wm_keymap_patch_update()

static wmKeyMap* wm_keymap_patch_update ( ListBase lb,
wmKeyMap defaultmap,
wmKeyMap addonmap,
wmKeyMap usermap 
)
static

◆ WM_keymap_poll()

bool WM_keymap_poll ( bContext C,
wmKeyMap keymap 
)

◆ wm_keymap_preset()

static wmKeyMap* wm_keymap_preset ( wmWindowManager wm,
wmKeyMap km 
)
static

◆ WM_keymap_remove()

bool WM_keymap_remove ( wmKeyConfig keyconf,
wmKeyMap keymap 
)

◆ WM_keymap_remove_item()

bool WM_keymap_remove_item ( wmKeyMap keymap,
wmKeyMapItem kmi 
)

◆ WM_keymap_restore_to_default()

void WM_keymap_restore_to_default ( wmKeyMap keymap,
wmWindowManager wm 
)

◆ wm_keymap_test_and_clear_update()

static bool wm_keymap_test_and_clear_update ( wmKeyMap km)
static

◆ WM_modalkeymap_add_item()

wmKeyMapItem* WM_modalkeymap_add_item ( wmKeyMap km,
const KeyMapItem_Params params,
int  value 
)

◆ WM_modalkeymap_add_item_str()

wmKeyMapItem* WM_modalkeymap_add_item_str ( wmKeyMap km,
const KeyMapItem_Params params,
const char *  value 
)

◆ WM_modalkeymap_assign()

void WM_modalkeymap_assign ( wmKeyMap km,
const char *  opname 
)

◆ WM_modalkeymap_ensure()

wmKeyMap* WM_modalkeymap_ensure ( wmKeyConfig keyconf,
const char *  idname,
const EnumPropertyItem items 
)

◆ WM_modalkeymap_find()

wmKeyMap* WM_modalkeymap_find ( wmKeyConfig keyconf,
const char *  idname 
)

◆ WM_modalkeymap_find_propvalue()

const wmKeyMapItem* WM_modalkeymap_find_propvalue ( const wmKeyMap km,
const int  propvalue 
)

◆ wm_modalkeymap_find_propvalue_iter()

static const wmKeyMapItem* wm_modalkeymap_find_propvalue_iter ( const wmKeyMap km,
const wmKeyMapItem kmi,
const int  propvalue 
)
static

◆ WM_modalkeymap_items_to_string()

int WM_modalkeymap_items_to_string ( const wmKeyMap km,
const int  propvalue,
const bool  compact,
char *  result,
const int  result_len 
)

◆ WM_modalkeymap_operator_items_to_string()

int WM_modalkeymap_operator_items_to_string ( wmOperatorType ot,
const int  propvalue,
const bool  compact,
char *  result,
const int  result_len 
)

◆ WM_modalkeymap_operator_items_to_string_buf()

char* WM_modalkeymap_operator_items_to_string_buf ( wmOperatorType ot,
const int  propvalue,
const bool  compact,
const int  max_len,
int *  r_available_len,
char **  r_result 
)

Definition at line 1270 of file wm_keymap.c.

References min_ii(), ot, ret, and WM_modalkeymap_operator_items_to_string().

Referenced by WM_window_modal_keymap_status_draw().

◆ wm_user_modal_keymap_set_items()

static void wm_user_modal_keymap_set_items ( wmWindowManager wm,
wmKeyMap km 
)
static

Variable Documentation

◆ wm_keymap_update_flag

char wm_keymap_update_flag = 0
static