diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-21 12:16:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-21 12:16:15 +0400 |
commit | 04db8ad282ec305ab61245b7556e15121d9cdcc5 (patch) | |
tree | 49bb50c8598051771b572b3ebfbfdc76ccff26a1 /source/blender/windowmanager | |
parent | f9f5daed9bb0b1f239b3b3d3de7e6ff95b56e3d2 (diff) |
misc cleanup
- remove redundant casts
- replace strcmp's with "" to just check first char.
- added WM_event_print(), debug mode only to print events since the structs values are not that meaningful.
- added warnings if locale/font dirs cant be found.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 33 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 2 |
3 files changed, 37 insertions, 1 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 9e19a057175..34f59ce047d 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -267,6 +267,9 @@ void WM_gestures_remove(struct bContext *C); /* fileselecting support */ void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op); void WM_event_fileselect_event(struct bContext *C, void *ophandle, int eventval); +#ifndef NDEBUG +void WM_event_print(struct wmEvent *event); +#endif /* drag and drop */ struct wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 6fd84b4c315..e73440e5eb0 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -79,6 +79,10 @@ #include "wm_event_types.h" #include "wm_draw.h" +#ifndef NDEBUG +# include "RNA_enum_types.h" +#endif + static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports, short context, short poll_only); /* ************ event management ************** */ @@ -435,6 +439,35 @@ static void wm_operator_print(bContext *C, wmOperator *op) MEM_freeN(buf); } +/* for debugging only, getting inspecting events manually is tedious */ +#ifndef NDEBUG + +void WM_event_print(wmEvent *event) +{ + if(event) { + const char *unknown= "UNKNOWN"; + const char *type_id= unknown; + const char *val_id= unknown; + + RNA_enum_identifier(event_type_items, event->type, &type_id); + RNA_enum_identifier(event_value_items, event->val, &val_id); + + printf("wmEvent - type:%d/%s, val:%d/%s, " + "shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d, " + "mouse:(%d,%d), ascii:'%c', utf8:'%.6s', " + "keymap_idname:%s, pointer:%p\n", + event->type, type_id, event->val, val_id, + event->shift, event->ctrl, event->alt, event->oskey, event->keymodifier, + event->x, event->y, event->ascii, event->utf8_buf, + event->keymap_idname, (void *)event); + } + else { + printf("wmEvent - NULL\n"); + } +} + +#endif /* NDEBUG */ + static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int popup) { if(popup) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7a8d69e58a5..a06da3941af 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -678,7 +678,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) else { pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); layout= uiPupMenuLayout(pup); - uiItemsFullEnumO(layout, op->type->idname, (char*)RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); + uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); uiPupMenuEnd(C, pup); } |