diff options
Diffstat (limited to 'source')
66 files changed, 1010 insertions, 988 deletions
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index 67b15af321a..4666151f84a 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -31,14 +31,7 @@ #define WIN32_LEAN_AND_MEAN -#ifndef WIN32_SKIP_HKEY_PROTECTION -# undef HKEY -# define HKEY WIN32_HKEY /* prevent competing definitions */ -# include <windows.h> -# undef HKEY -#else -# include <windows.h> -#endif +#include <windows.h> #undef near #undef far diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 93cb2d1e306..4e2b126e2fb 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -965,7 +965,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even else { bool handled = false; switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: ed_marker_move_cancel(C, op); return OPERATOR_CANCELLED; case RIGHTMOUSE: @@ -977,8 +977,8 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even /* else continue; <--- see if release event should be caught for tweak-end */ ATTR_FALLTHROUGH; - case RETKEY: - case PADENTER: + case EVT_RETKEY: + case EVT_PADENTER: case LEFTMOUSE: case MIDDLEMOUSE: if (WM_event_is_modal_tweak_exit(event, mm->event_type)) { diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index fb045abe016..a85ec8a5d14 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -215,7 +215,7 @@ static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event) int ret = OPERATOR_RUNNING_MODAL; /* execute the events */ switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: ret = OPERATOR_FINISHED; break; @@ -233,8 +233,8 @@ static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event) } break; - case LEFTCTRLKEY: - case RIGHTCTRLKEY: + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: if (event->val == KM_RELEASE) { RNA_boolean_set(op->ptr, "snap", false); } diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 63c096abc6d..4bd7ad6629a 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -1329,7 +1329,7 @@ static void poselib_preview_handle_search(tPoseLib_PreviewData *pld, { /* try doing some form of string manipulation first */ switch (event) { - case BACKSPACEKEY: + case EVT_BACKSPACEKEY: if (pld->searchstr[0] && pld->search_cursor) { short len = strlen(pld->searchstr); short index = pld->search_cursor; @@ -1347,7 +1347,7 @@ static void poselib_preview_handle_search(tPoseLib_PreviewData *pld, } break; - case DELKEY: + case EVT_DELKEY: if (pld->searchstr[0] && pld->searchstr[1]) { short len = strlen(pld->searchstr); short index = pld->search_cursor; @@ -1414,16 +1414,16 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con if (pld->flag & PL_PREVIEW_SHOWORIGINAL) { switch (event->type) { /* exit - cancel */ - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: pld->state = PL_PREVIEW_CANCEL; break; /* exit - confirm */ case LEFTMOUSE: - case RETKEY: - case PADENTER: - case SPACEKEY: + case EVT_RETKEY: + case EVT_PADENTER: + case EVT_SPACEKEY: pld->state = PL_PREVIEW_CONFIRM; break; @@ -1431,18 +1431,18 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con /* we add pass through here, so that the operators responsible for these can still run, * even though we still maintain control (as RUNNING_MODAL flag is still set too) */ - case PAD0: - case PAD1: - case PAD2: - case PAD3: - case PAD4: - case PAD5: - case PAD6: - case PAD7: - case PAD8: - case PAD9: - case PADPLUSKEY: - case PADMINUS: + case EVT_PAD0: + case EVT_PAD1: + case EVT_PAD2: + case EVT_PAD3: + case EVT_PAD4: + case EVT_PAD5: + case EVT_PAD6: + case EVT_PAD7: + case EVT_PAD8: + case EVT_PAD9: + case EVT_PADPLUSKEY: + case EVT_PADMINUS: case MIDDLEMOUSE: case MOUSEMOVE: // pld->redraw = PL_PREVIEW_REDRAWHEADER; @@ -1450,7 +1450,7 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con break; /* quicky compare to original */ - case TABKEY: + case EVT_TABKEY: pld->flag &= ~PL_PREVIEW_SHOWORIGINAL; pld->redraw = PL_PREVIEW_REDRAWALL; break; @@ -1464,53 +1464,53 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con /* searching takes priority over normal activity */ switch (event->type) { /* exit - cancel */ - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: pld->state = PL_PREVIEW_CANCEL; break; /* exit - confirm */ case LEFTMOUSE: - case RETKEY: - case PADENTER: - case SPACEKEY: + case EVT_RETKEY: + case EVT_PADENTER: + case EVT_SPACEKEY: pld->state = PL_PREVIEW_CONFIRM; break; /* toggle between original pose and poselib pose*/ - case TABKEY: + case EVT_TABKEY: pld->flag |= PL_PREVIEW_SHOWORIGINAL; pld->redraw = PL_PREVIEW_REDRAWALL; break; /* change to previous pose (cyclic) */ - case PAGEUPKEY: + case EVT_PAGEUPKEY: case WHEELUPMOUSE: poselib_preview_get_next(pld, -1); pld->redraw = PL_PREVIEW_REDRAWALL; break; /* change to next pose (cyclic) */ - case PAGEDOWNKEY: + case EVT_PAGEDOWNKEY: case WHEELDOWNMOUSE: poselib_preview_get_next(pld, 1); pld->redraw = PL_PREVIEW_REDRAWALL; break; /* jump 5 poses (cyclic, back) */ - case DOWNARROWKEY: + case EVT_DOWNARROWKEY: poselib_preview_get_next(pld, -5); pld->redraw = PL_PREVIEW_REDRAWALL; break; /* jump 5 poses (cyclic, forward) */ - case UPARROWKEY: + case EVT_UPARROWKEY: poselib_preview_get_next(pld, 5); pld->redraw = PL_PREVIEW_REDRAWALL; break; /* change to next pose or searching cursor control */ - case RIGHTARROWKEY: + case EVT_RIGHTARROWKEY: if (pld->searchstr[0]) { /* move text-cursor to the right */ if (pld->search_cursor < strlen(pld->searchstr)) { @@ -1526,7 +1526,7 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con break; /* change to next pose or searching cursor control */ - case LEFTARROWKEY: + case EVT_LEFTARROWKEY: if (pld->searchstr[0]) { /* move text-cursor to the left */ if (pld->search_cursor) { @@ -1542,7 +1542,7 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con break; /* change to first pose or start of searching string */ - case HOMEKEY: + case EVT_HOMEKEY: if (pld->searchstr[0]) { pld->search_cursor = 0; pld->redraw = PL_PREVIEW_REDRAWHEADER; @@ -1557,7 +1557,7 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con break; /* change to last pose or start of searching string */ - case ENDKEY: + case EVT_ENDKEY: if (pld->searchstr[0]) { pld->search_cursor = strlen(pld->searchstr); pld->redraw = PL_PREVIEW_REDRAWHEADER; @@ -1582,18 +1582,18 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con break; /* view manipulation, or searching */ - case PAD0: - case PAD1: - case PAD2: - case PAD3: - case PAD4: - case PAD5: - case PAD6: - case PAD7: - case PAD8: - case PAD9: - case PADPLUSKEY: - case PADMINUS: + case EVT_PAD0: + case EVT_PAD1: + case EVT_PAD2: + case EVT_PAD3: + case EVT_PAD4: + case EVT_PAD5: + case EVT_PAD6: + case EVT_PAD7: + case EVT_PAD8: + case EVT_PAD9: + case EVT_PADPLUSKEY: + case EVT_PADMINUS: if (pld->searchstr[0]) { /* searching... */ poselib_preview_handle_search(pld, event->type, event->ascii); diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index 8463f0ef827..f24779e1baa 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -1067,8 +1067,8 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { case LEFTMOUSE: /* confirm */ - case RETKEY: - case PADENTER: { + case EVT_RETKEY: + case EVT_PADENTER: { if (event->val == KM_PRESS) { /* return to normal cursor and header status */ ED_area_status_text(pso->sa, NULL); @@ -1084,7 +1084,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) break; } - case ESCKEY: /* cancel */ + case EVT_ESCKEY: /* cancel */ case RIGHTMOUSE: { if (event->val == KM_PRESS) { /* return to normal cursor and header status */ @@ -1141,31 +1141,31 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { /* Transform Channel Limits */ /* XXX: Replace these hardcoded hotkeys with a modalmap that can be customised */ - case GKEY: /* Location */ + case EVT_GKEY: /* Location */ { pose_slide_toggle_channels_mode(op, pso, PS_TFM_LOC); do_pose_update = true; break; } - case RKEY: /* Rotation */ + case EVT_RKEY: /* Rotation */ { pose_slide_toggle_channels_mode(op, pso, PS_TFM_ROT); do_pose_update = true; break; } - case SKEY: /* Scale */ + case EVT_SKEY: /* Scale */ { pose_slide_toggle_channels_mode(op, pso, PS_TFM_SIZE); do_pose_update = true; break; } - case BKEY: /* Bendy Bones */ + case EVT_BKEY: /* Bendy Bones */ { pose_slide_toggle_channels_mode(op, pso, PS_TFM_BBONE_SHAPE); do_pose_update = true; break; } - case CKEY: /* Custom Properties */ + case EVT_CKEY: /* Custom Properties */ { pose_slide_toggle_channels_mode(op, pso, PS_TFM_PROPS); do_pose_update = true; @@ -1174,19 +1174,19 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) /* Axis Locks */ /* XXX: Hardcoded... */ - case XKEY: { + case EVT_XKEY: { if (pose_slide_toggle_axis_locks(op, pso, PS_LOCK_X)) { do_pose_update = true; } break; } - case YKEY: { + case EVT_YKEY: { if (pose_slide_toggle_axis_locks(op, pso, PS_LOCK_Y)) { do_pose_update = true; } break; } - case ZKEY: { + case EVT_ZKEY: { if (pose_slide_toggle_axis_locks(op, pso, PS_LOCK_Z)) { do_pose_update = true; } diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 85441c9b88d..ffc09596b03 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -1154,7 +1154,7 @@ static int curve_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } } - else if (ELEM(event->type, ESCKEY, RIGHTMOUSE)) { + else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) { ED_region_tag_redraw(cdd->vc.region); curve_draw_cancel(C, op); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 1f57c6cfe0a..5fe7082d59b 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1684,7 +1684,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event) } /* tab should exit editmode, but we allow it to be typed using modifier keys */ - if (event_type == TABKEY) { + if (event_type == EVT_TABKEY) { if ((alt || ctrl || shift) == 0) { return OPERATOR_PASS_THROUGH; } @@ -1693,7 +1693,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event) } } - if (event_type == BACKSPACEKEY) { + if (event_type == EVT_BACKSPACEKEY) { if (alt && ef->len != 0 && ef->pos > 0) { accentcode = 1; } diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 3e33f811225..5629e29f257 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -2050,20 +2050,35 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* We don't pass on key events, GP is used with key-modifiers - * prevents Dkey to insert drivers. */ if (ISKEYBOARD(event->type)) { - if (ELEM(event->type, LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY, ZKEY)) { + if (ELEM(event->type, + EVT_LEFTARROWKEY, + EVT_DOWNARROWKEY, + EVT_RIGHTARROWKEY, + EVT_UPARROWKEY, + EVT_ZKEY)) { /* allow some keys: * - for frame changing [#33412] * - for undo (during sketching sessions) */ } - else if (ELEM(event->type, PAD0, PAD1, PAD2, PAD3, PAD4, PAD5, PAD6, PAD7, PAD8, PAD9)) { + else if (ELEM(event->type, + EVT_PAD0, + EVT_PAD1, + EVT_PAD2, + EVT_PAD3, + EVT_PAD4, + EVT_PAD5, + EVT_PAD6, + EVT_PAD7, + EVT_PAD8, + EVT_PAD9)) { /* allow numpad keys so that camera/view manipulations can still take place * - PAD0 in particular is really important for Grease Pencil drawing, * as animators may be working "to camera", so having this working * is essential for ensuring that they can quickly return to that view */ } - else if ((event->type == BKEY) && (event->val == KM_RELEASE)) { + else if ((event->type == EVT_BKEY) && (event->val == KM_RELEASE)) { /* Add Blank Frame * - Since this operator is non-modal, we can just call it here, and keep going... * - This operator is especially useful when animating @@ -2083,7 +2098,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) * NOTE: cannot do RIGHTMOUSE (as is standard for canceling) * as that would break polyline T32647. */ - if (event->val == KM_PRESS && ELEM(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY, EKEY)) { + if (event->val == KM_PRESS && + ELEM(event->type, EVT_RETKEY, EVT_PADENTER, EVT_ESCKEY, EVT_SPACEKEY, EVT_EKEY)) { /* exit() ends the current stroke before cleaning up */ /* printf("\t\tGP - end of paint op + end of stroke\n"); */ p->status = GP_STATUS_DONE; @@ -2261,19 +2277,19 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* eraser size */ else if ((p->paintmode == GP_PAINTMODE_ERASER) && - ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, PADPLUSKEY, PADMINUS)) { + ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, EVT_PADPLUSKEY, EVT_PADMINUS)) { /* just resize the brush (local version) * TODO: fix the hardcoded size jumps (set to make a visible difference) and hardcoded keys */ /* printf("\t\tGP - resize eraser\n"); */ switch (event->type) { case WHEELDOWNMOUSE: /* larger */ - case PADPLUSKEY: + case EVT_PADPLUSKEY: p->radius += 5; break; case WHEELUPMOUSE: /* smaller */ - case PADMINUS: + case EVT_PADMINUS: p->radius -= 5; if (p->radius <= 0) { diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index c928c1e933a..a7fc5a4965b 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1487,7 +1487,7 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event) int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass through */ switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: estate = OPERATOR_CANCELLED; break; diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index bd00a492035..958728c2baf 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -563,8 +563,8 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent switch (event->type) { case LEFTMOUSE: /* confirm */ - case PADENTER: - case RETKEY: { + case EVT_PADENTER: + case EVT_RETKEY: { /* return to normal cursor and header status */ ED_area_status_text(tgpi->sa, NULL); ED_workspace_status_text(C, NULL); @@ -598,7 +598,7 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent return OPERATOR_FINISHED; } - case ESCKEY: /* cancel */ + case EVT_ESCKEY: /* cancel */ case RIGHTMOUSE: { /* return to normal cursor and header status */ ED_area_status_text(tgpi->sa, NULL); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index e7586d95d29..90076b8d91b 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2897,7 +2897,7 @@ static void gpencil_guide_event_handling(bContext *C, GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide; /* Enter or exit set center point mode */ - if ((event->type == OKEY) && (event->val == KM_RELEASE)) { + if ((event->type == EVT_OKEY) && (event->val == KM_RELEASE)) { if ((p->paintmode == GP_PAINTMODE_DRAW) && guide->use_guide && (guide->reference_point != GP_GUIDE_REF_OBJECT)) { add_notifier = true; @@ -2906,12 +2906,12 @@ static void gpencil_guide_event_handling(bContext *C, } } /* Freehand mode, turn off speed guide */ - else if ((event->type == VKEY) && (event->val == KM_RELEASE)) { + else if ((event->type == EVT_VKEY) && (event->val == KM_RELEASE)) { guide->use_guide = false; add_notifier = true; } /* Alternate or flip direction */ - else if ((event->type == MKEY) && (event->val == KM_RELEASE)) { + else if ((event->type == EVT_MKEY) && (event->val == KM_RELEASE)) { if (guide->type == GP_GUIDE_CIRCULAR) { add_notifier = true; guide->type = GP_GUIDE_RADIAL; @@ -2930,7 +2930,7 @@ static void gpencil_guide_event_handling(bContext *C, } } /* Line guides */ - else if ((event->type == LKEY) && (event->val == KM_RELEASE)) { + else if ((event->type == EVT_LKEY) && (event->val == KM_RELEASE)) { add_notifier = true; guide->use_guide = true; if (event->ctrl) { @@ -2946,7 +2946,7 @@ static void gpencil_guide_event_handling(bContext *C, } } /* Point guide */ - else if ((event->type == CKEY) && (event->val == KM_RELEASE)) { + else if ((event->type == EVT_CKEY) && (event->val == KM_RELEASE)) { add_notifier = true; if (!guide->use_guide) { guide->use_guide = true; @@ -2963,7 +2963,7 @@ static void gpencil_guide_event_handling(bContext *C, } } /* Change line angle */ - else if (ELEM(event->type, JKEY, KKEY) && (event->val == KM_RELEASE)) { + else if (ELEM(event->type, EVT_JKEY, EVT_KKEY) && (event->val == KM_RELEASE)) { add_notifier = true; float angle = guide->angle; float adjust = (float)M_PI / 180.0f; @@ -2973,7 +2973,7 @@ static void gpencil_guide_event_handling(bContext *C, else if (!event->shift) { adjust *= 15.0f; } - angle += (event->type == JKEY) ? adjust : -adjust; + angle += (event->type == EVT_JKEY) ? adjust : -adjust; angle = angle_compat_rad(angle, M_PI); guide->angle = angle; } @@ -3373,7 +3373,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { /* cancel */ - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: { if (ELEM(event->val, KM_RELEASE)) { drawmode = true; @@ -3404,26 +3404,36 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* We don't pass on key events, GP is used with key-modifiers - * prevents Dkey to insert drivers. */ if (ISKEYBOARD(event->type)) { - if (ELEM(event->type, LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY)) { + if (ELEM(event->type, EVT_LEFTARROWKEY, EVT_DOWNARROWKEY, EVT_RIGHTARROWKEY, EVT_UPARROWKEY)) { /* allow some keys: * - for frame changing [#33412] * - for undo (during sketching sessions) */ } - else if (event->type == ZKEY) { + else if (event->type == EVT_ZKEY) { if (event->ctrl) { p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; } } - else if (ELEM(event->type, PAD0, PAD1, PAD2, PAD3, PAD4, PAD5, PAD6, PAD7, PAD8, PAD9)) { + else if (ELEM(event->type, + EVT_PAD0, + EVT_PAD1, + EVT_PAD2, + EVT_PAD3, + EVT_PAD4, + EVT_PAD5, + EVT_PAD6, + EVT_PAD7, + EVT_PAD8, + EVT_PAD9)) { /* allow numpad keys so that camera/view manipulations can still take place * - PAD0 in particular is really important for Grease Pencil drawing, * as animators may be working "to camera", so having this working * is essential for ensuring that they can quickly return to that view */ } - else if ((event->type == BKEY) && (event->val == KM_RELEASE)) { + else if ((event->type == EVT_BKEY) && (event->val == KM_RELEASE)) { /* Add Blank Frame * - Since this operator is non-modal, we can just call it here, and keep going... * - This operator is especially useful when animating @@ -3443,7 +3453,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* Exit painting mode (and/or end current stroke). * */ - if (ELEM(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY, EKEY)) { + if (ELEM(event->type, EVT_RETKEY, EVT_PADENTER, EVT_ESCKEY, EVT_SPACEKEY, EVT_EKEY)) { p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; @@ -3591,16 +3601,16 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* eraser size */ else if ((p->paintmode == GP_PAINTMODE_ERASER) && - ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, PADPLUSKEY, PADMINUS)) { + ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, EVT_PADPLUSKEY, EVT_PADMINUS)) { /* Just resize the brush (local version). */ switch (event->type) { case WHEELDOWNMOUSE: /* larger */ - case PADPLUSKEY: + case EVT_PADPLUSKEY: p->radius += 5; break; case WHEELUPMOUSE: /* smaller */ - case PADMINUS: + case EVT_PADMINUS: p->radius -= 5; if (p->radius <= 0) { diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 5cb34b1c08b..f7bfc0bab8c 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -1429,7 +1429,7 @@ static void gpencil_primitive_edit_event_handling( } break; } - case MKEY: { + case EVT_MKEY: { if ((event->val == KM_PRESS) && (tgpi->curve) && (ELEM(tgpi->orign_type, GP_STROKE_ARC))) { tgpi->flip ^= 1; gp_primitive_update_cps(tgpi); @@ -1437,7 +1437,7 @@ static void gpencil_primitive_edit_event_handling( } break; } - case EKEY: { + case EVT_EKEY: { if (tgpi->flag == IN_CURVE_EDIT && !ELEM(tgpi->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) { tgpi->flag = IN_PROGRESS; WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); @@ -1544,7 +1544,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e gpencil_primitive_update(C, op, tgpi); break; } - case ESCKEY: + case EVT_ESCKEY: case LEFTMOUSE: { zero_v2(tgpi->move); tgpi->flag = IN_CURVE_EDIT; @@ -1566,7 +1566,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e switch (event->type) { - case ESCKEY: { + case EVT_ESCKEY: { /* return to normal cursor and header status */ ED_workspace_status_text(C, NULL); WM_cursor_modal_restore(win); @@ -1588,9 +1588,9 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } break; } - case SPACEKEY: /* confirm */ + case EVT_SPACEKEY: /* confirm */ case MIDDLEMOUSE: - case RETKEY: + case EVT_RETKEY: case RIGHTMOUSE: { if (event->val == KM_PRESS) { tgpi->flag = IDLE; @@ -1612,7 +1612,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e gpencil_primitive_update(C, op, tgpi); break; } - case PADPLUSKEY: + case EVT_PADPLUSKEY: case WHEELUPMOUSE: { if ((event->val != KM_RELEASE)) { tgpi->tot_edges = tgpi->tot_edges + 1; @@ -1622,7 +1622,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } break; } - case PADMINUS: + case EVT_PADMINUS: case WHEELDOWNMOUSE: { if ((event->val != KM_RELEASE)) { tgpi->tot_edges = tgpi->tot_edges - 1; @@ -1632,7 +1632,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } break; } - case FKEY: /* brush thickness/ brush strength */ + case EVT_FKEY: /* brush thickness/ brush strength */ { if ((event->val == KM_PRESS)) { if (event->shift) { @@ -1658,7 +1658,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e gpencil_primitive_size(tgpi, false); gpencil_primitive_update(C, op, tgpi); break; - case ESCKEY: + case EVT_ESCKEY: case MIDDLEMOUSE: case LEFTMOUSE: tgpi->brush_size = 0; @@ -1681,7 +1681,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e gpencil_primitive_strength(tgpi, false); gpencil_primitive_update(C, op, tgpi); break; - case ESCKEY: + case EVT_ESCKEY: case MIDDLEMOUSE: case LEFTMOUSE: tgpi->brush_strength = 0.0f; @@ -1748,10 +1748,10 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } break; } - case SPACEKEY: /* confirm */ + case EVT_SPACEKEY: /* confirm */ case MIDDLEMOUSE: - case PADENTER: - case RETKEY: { + case EVT_PADENTER: + case EVT_RETKEY: { tgpi->flag = IDLE; gpencil_primitive_interaction_end(C, op, win, tgpi); /* done! */ @@ -1769,7 +1769,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } ATTR_FALLTHROUGH; } - case ESCKEY: { + case EVT_ESCKEY: { /* return to normal cursor and header status */ ED_workspace_status_text(C, NULL); WM_cursor_modal_restore(win); @@ -1780,7 +1780,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e /* canceled! */ return OPERATOR_CANCELLED; } - case PADPLUSKEY: + case EVT_PADPLUSKEY: case WHEELUPMOUSE: { if ((event->val != KM_RELEASE)) { tgpi->tot_edges = tgpi->tot_edges + 1; @@ -1792,7 +1792,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } break; } - case PADMINUS: + case EVT_PADMINUS: case WHEELDOWNMOUSE: { if ((event->val != KM_RELEASE)) { tgpi->tot_edges = tgpi->tot_edges - 1; @@ -1804,7 +1804,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } break; } - case GKEY: /* grab mode */ + case EVT_GKEY: /* grab mode */ { if ((event->val == KM_PRESS)) { tgpi->flag = IN_MOVE; @@ -1812,7 +1812,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } break; } - case FKEY: /* brush thickness/ brush strength */ + case EVT_FKEY: /* brush thickness/ brush strength */ { if ((event->val == KM_PRESS)) { if (event->shift) { @@ -1827,7 +1827,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } break; } - case CKEY: /* curve mode */ + case EVT_CKEY: /* curve mode */ { if ((event->val == KM_PRESS) && (tgpi->orign_type == GP_STROKE_CURVE)) { switch (tgpi->type) { @@ -1846,7 +1846,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } break; } - case TABKEY: { + case EVT_TABKEY: { if (tgpi->flag == IN_CURVE_EDIT) { tgpi->flag = IN_PROGRESS; WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 5db331280f8..8c92d53b8e6 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -2028,7 +2028,7 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even /* Abort painting if any of the usual things are tried */ case MIDDLEMOUSE: case RIGHTMOUSE: - case ESCKEY: + case EVT_ESCKEY: gpsculpt_brush_exit(C, op); return OPERATOR_FINISHED; } @@ -2050,7 +2050,7 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even /* Exit modal operator, based on the "standard" ops */ case RIGHTMOUSE: - case ESCKEY: + case EVT_ESCKEY: gpsculpt_brush_exit(C, op); return OPERATOR_FINISHED; @@ -2065,24 +2065,24 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even break; /* Change Frame - Allowed */ - case LEFTARROWKEY: - case RIGHTARROWKEY: - case UPARROWKEY: - case DOWNARROWKEY: + case EVT_LEFTARROWKEY: + case EVT_RIGHTARROWKEY: + case EVT_UPARROWKEY: + case EVT_DOWNARROWKEY: return OPERATOR_PASS_THROUGH; /* Camera/View Gizmo's - Allowed */ /* (See rationale in gpencil_paint.c -> gpencil_draw_modal()) */ - case PAD0: - case PAD1: - case PAD2: - case PAD3: - case PAD4: - case PAD5: - case PAD6: - case PAD7: - case PAD8: - case PAD9: + case EVT_PAD0: + case EVT_PAD1: + case EVT_PAD2: + case EVT_PAD3: + case EVT_PAD4: + case EVT_PAD5: + case EVT_PAD6: + case EVT_PAD7: + case EVT_PAD8: + case EVT_PAD9: return OPERATOR_PASS_THROUGH; /* Unhandled event */ diff --git a/source/blender/editors/gpencil/gpencil_uv.c b/source/blender/editors/gpencil/gpencil_uv.c index 5e397374437..8e9d46793a9 100644 --- a/source/blender/editors/gpencil/gpencil_uv.c +++ b/source/blender/editors/gpencil/gpencil_uv.c @@ -436,7 +436,7 @@ static int gpencil_transform_fill_modal(bContext *C, wmOperator *op, const wmEve GpUvData *opdata = op->customdata; switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: { gpencil_transform_fill_cancel(C, op); return OPERATOR_CANCELLED; @@ -455,8 +455,8 @@ static int gpencil_transform_fill_modal(bContext *C, wmOperator *op, const wmEve break; } case LEFTMOUSE: - case PADENTER: - case RETKEY: { + case EVT_PADENTER: + case EVT_RETKEY: { if ((event->val == KM_PRESS) || ((event->val == KM_RELEASE) && RNA_boolean_get(op->ptr, "release_confirm"))) { gpencil_uv_transform_calc(C, op); diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c index 45dc22bafba..0c3b29ab1ea 100644 --- a/source/blender/editors/gpencil/gpencil_vertex_paint.c +++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c @@ -1308,7 +1308,7 @@ static int gp_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent /* Abort painting if any of the usual things are tried */ case MIDDLEMOUSE: case RIGHTMOUSE: - case ESCKEY: + case EVT_ESCKEY: gp_vertexpaint_brush_exit(C, op); return OPERATOR_FINISHED; } @@ -1329,7 +1329,7 @@ static int gp_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent /* Exit modal operator, based on the "standard" ops */ case RIGHTMOUSE: - case ESCKEY: + case EVT_ESCKEY: gp_vertexpaint_brush_exit(C, op); return OPERATOR_FINISHED; @@ -1344,24 +1344,24 @@ static int gp_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent break; /* Change Frame - Allowed */ - case LEFTARROWKEY: - case RIGHTARROWKEY: - case UPARROWKEY: - case DOWNARROWKEY: + case EVT_LEFTARROWKEY: + case EVT_RIGHTARROWKEY: + case EVT_UPARROWKEY: + case EVT_DOWNARROWKEY: return OPERATOR_PASS_THROUGH; /* Camera/View Gizmo's - Allowed */ /* (See rationale in gpencil_paint.c -> gpencil_draw_modal()) */ - case PAD0: - case PAD1: - case PAD2: - case PAD3: - case PAD4: - case PAD5: - case PAD6: - case PAD7: - case PAD8: - case PAD9: + case EVT_PAD0: + case EVT_PAD1: + case EVT_PAD2: + case EVT_PAD3: + case EVT_PAD4: + case EVT_PAD5: + case EVT_PAD6: + case EVT_PAD7: + case EVT_PAD8: + case EVT_PAD9: return OPERATOR_PASS_THROUGH; /* Unhandled event */ diff --git a/source/blender/editors/gpencil/gpencil_weight_paint.c b/source/blender/editors/gpencil/gpencil_weight_paint.c index c519129cdf7..0dace9f004b 100644 --- a/source/blender/editors/gpencil/gpencil_weight_paint.c +++ b/source/blender/editors/gpencil/gpencil_weight_paint.c @@ -798,7 +798,7 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent /* Abort painting if any of the usual things are tried */ case MIDDLEMOUSE: case RIGHTMOUSE: - case ESCKEY: + case EVT_ESCKEY: gp_weightpaint_brush_exit(C, op); return OPERATOR_FINISHED; } @@ -819,7 +819,7 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent /* Exit modal operator, based on the "standard" ops */ case RIGHTMOUSE: - case ESCKEY: + case EVT_ESCKEY: gp_weightpaint_brush_exit(C, op); return OPERATOR_FINISHED; @@ -834,24 +834,24 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent break; /* Change Frame - Allowed */ - case LEFTARROWKEY: - case RIGHTARROWKEY: - case UPARROWKEY: - case DOWNARROWKEY: + case EVT_LEFTARROWKEY: + case EVT_RIGHTARROWKEY: + case EVT_UPARROWKEY: + case EVT_DOWNARROWKEY: return OPERATOR_PASS_THROUGH; /* Camera/View Gizmo's - Allowed */ /* (See rationale in gpencil_paint.c -> gpencil_draw_modal()) */ - case PAD0: - case PAD1: - case PAD2: - case PAD3: - case PAD4: - case PAD5: - case PAD6: - case PAD7: - case PAD8: - case PAD9: + case EVT_PAD0: + case EVT_PAD1: + case EVT_PAD2: + case EVT_PAD3: + case EVT_PAD4: + case EVT_PAD5: + case EVT_PAD6: + case EVT_PAD7: + case EVT_PAD8: + case EVT_PAD9: return OPERATOR_PASS_THROUGH; /* Unhandled event */ diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index f6da9663daf..7a300860583 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -233,7 +233,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg) /* XXX this guess_opname can potentially return a different keymap * than being found on adding later... */ km = WM_keymap_guess_opname(C, idname); - kmi = WM_keymap_add_item(km, idname, AKEY, KM_PRESS, 0, 0); + kmi = WM_keymap_add_item(km, idname, EVT_AKEY, KM_PRESS, 0, 0); kmi_id = kmi->id; /* This takes ownership of prop, or prop can be NULL for reset. */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f4dd114c312..27549ed60b5 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -634,8 +634,8 @@ static enum eSnapType ui_event_to_snap(const wmEvent *event) static bool ui_event_is_snap(const wmEvent *event) { - return (ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY) || - ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)); + return (ELEM(event->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY) || + ELEM(event->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)); } static void ui_color_snap_hue(const enum eSnapType snap, float *r_hue) @@ -3513,7 +3513,7 @@ static void ui_do_but_textedit( break; case RIGHTMOUSE: - case ESCKEY: + case EVT_ESCKEY: if (event->val == KM_PRESS) { #ifdef WITH_INPUT_IME /* skips button handling since it is not wanted */ @@ -3584,24 +3584,24 @@ static void ui_do_but_textedit( if (event->val == KM_PRESS && !is_ime_composing) { switch (event->type) { - case VKEY: - case XKEY: - case CKEY: + case EVT_VKEY: + case EVT_XKEY: + case EVT_CKEY: if (IS_EVENT_MOD(event, ctrl, oskey)) { - if (event->type == VKEY) { + if (event->type == EVT_VKEY) { changed = ui_textedit_copypaste(but, data, UI_TEXTEDIT_PASTE); } - else if (event->type == CKEY) { + else if (event->type == EVT_CKEY) { changed = ui_textedit_copypaste(but, data, UI_TEXTEDIT_COPY); } - else if (event->type == XKEY) { + else if (event->type == EVT_XKEY) { changed = ui_textedit_copypaste(but, data, UI_TEXTEDIT_CUT); } retval = WM_UI_HANDLER_BREAK; } break; - case RIGHTARROWKEY: + case EVT_RIGHTARROWKEY: ui_textedit_move(but, data, STRCUR_DIR_NEXT, @@ -3609,7 +3609,7 @@ static void ui_do_but_textedit( event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; - case LEFTARROWKEY: + case EVT_LEFTARROWKEY: ui_textedit_move(but, data, STRCUR_DIR_PREV, @@ -3618,7 +3618,7 @@ static void ui_do_but_textedit( retval = WM_UI_HANDLER_BREAK; break; case WHEELDOWNMOUSE: - case DOWNARROWKEY: + case EVT_DOWNARROWKEY: if (data->searchbox) { #ifdef USE_KEYNAV_LIMIT ui_mouse_motion_keynav_init(&data->searchbox_keynav_state, event); @@ -3630,12 +3630,12 @@ static void ui_do_but_textedit( break; } ATTR_FALLTHROUGH; - case ENDKEY: + case EVT_ENDKEY: ui_textedit_move(but, data, STRCUR_DIR_NEXT, event->shift != 0, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; break; case WHEELUPMOUSE: - case UPARROWKEY: + case EVT_UPARROWKEY: if (data->searchbox) { #ifdef USE_KEYNAV_LIMIT ui_mouse_motion_keynav_init(&data->searchbox_keynav_state, event); @@ -3647,28 +3647,28 @@ static void ui_do_but_textedit( break; } ATTR_FALLTHROUGH; - case HOMEKEY: + case EVT_HOMEKEY: ui_textedit_move(but, data, STRCUR_DIR_PREV, event->shift != 0, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; break; - case PADENTER: - case RETKEY: + case EVT_PADENTER: + case EVT_RETKEY: button_activate_state(C, but, BUTTON_STATE_EXIT); retval = WM_UI_HANDLER_BREAK; break; - case DELKEY: + case EVT_DELKEY: changed = ui_textedit_delete( but, data, 1, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; - case BACKSPACEKEY: + case EVT_BACKSPACEKEY: changed = ui_textedit_delete( but, data, 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; - case AKEY: + case EVT_AKEY: /* Ctrl + A: Select all */ #if defined(__APPLE__) @@ -3685,7 +3685,7 @@ static void ui_do_but_textedit( } break; - case TABKEY: + case EVT_TABKEY: /* there is a key conflict here, we can't tab with autocomplete */ if (but->autocomplete_func || data->searchbox) { int autocomplete = ui_textedit_autocomplete(C, but, data); @@ -3719,7 +3719,7 @@ static void ui_do_but_textedit( /* exception that's useful for number buttons, some keyboard * numpads have a comma instead of a period */ if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { /* could use data->min*/ - if (event->type == PADPERIOD && ascii == ',') { + if (event->type == EVT_PADPERIOD && ascii == ',') { ascii = '.'; utf8_buf = NULL; /* force ascii fallback */ } @@ -4194,7 +4194,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, cons button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS) { + else if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH); return WM_UI_HANDLER_BREAK; } @@ -4218,7 +4218,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { but->drawstr[0] = 0; but->modifier_key = 0; button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT); @@ -4229,11 +4229,11 @@ static int ui_do_but_HOTKEYEVT(bContext *C, if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { return WM_UI_HANDLER_CONTINUE; } - else if (event->type == UNKNOWNKEY) { + else if (event->type == EVT_UNKNOWNKEY) { WM_report(RPT_WARNING, "Unsupported key: Unknown"); return WM_UI_HANDLER_CONTINUE; } - else if (event->type == CAPSLOCKKEY) { + else if (event->type == EVT_CAPSLOCKKEY) { WM_report(RPT_WARNING, "Unsupported key: CapsLock"); return WM_UI_HANDLER_CONTINUE; } @@ -4272,7 +4272,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, ED_region_tag_redraw(data->region); if (event->val == KM_PRESS) { - if (ISHOTKEY(event->type) && (event->type != ESCKEY)) { + if (ISHOTKEY(event->type) && (event->type != EVT_ESCKEY)) { if (WM_key_event_string(event->type, false)[0]) { ui_but_value_set(but, event->type); } @@ -4283,7 +4283,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } - else if (event->type == ESCKEY) { + else if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -4302,7 +4302,7 @@ static int ui_do_but_KEYEVT(bContext *C, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT); return WM_UI_HANDLER_BREAK; } @@ -4349,7 +4349,7 @@ static int ui_do_but_TAB( button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); return WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY)) { + else if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY)) { int event_val = (is_property) ? KM_PRESS : KM_CLICK; if (event->val == event_val) { button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -4373,8 +4373,9 @@ static int ui_do_but_TEX( bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY) && event->val == KM_PRESS) { - if (ELEM(event->type, PADENTER, RETKEY) && (!UI_but_is_utf8(but))) { + if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, EVT_PADENTER, EVT_RETKEY) && + event->val == KM_PRESS) { + if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && (!UI_but_is_utf8(but))) { /* pass - allow filesel, enter to execute */ } else if (but->dt == UI_EMBOSS_NONE && !event->ctrl) { @@ -4404,7 +4405,7 @@ static int ui_do_but_SEARCH_UNLINK( bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { /* unlink icon is on right */ - if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY)) { + if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, EVT_PADENTER, EVT_RETKEY)) { /* doing this on KM_PRESS calls eyedropper after clicking unlink icon */ if ((event->val == KM_RELEASE) && ui_do_but_extra_operator_icon(C, but, data, event)) { return WM_UI_HANDLER_BREAK; @@ -4426,7 +4427,7 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons if (data->state == BUTTON_STATE_HIGHLIGHT) { bool do_activate = false; - if (ELEM(event->type, PADENTER, RETKEY)) { + if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY)) { if (event->val == KM_PRESS) { do_activate = true; } @@ -4511,7 +4512,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con } #endif - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { int ret = WM_UI_HANDLER_BREAK; /* XXX (a bit ugly) Special case handling for filebrowser drag button */ if (but->dragpoin && but->imb && ui_but_contains_point_px_icon(but, data->region, event)) { @@ -4910,7 +4911,7 @@ static int ui_do_but_NUM( click = 1; } else if (event->val == KM_PRESS) { - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->ctrl) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } @@ -4919,10 +4920,10 @@ static int ui_do_but_NUM( button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); retval = WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS) { + else if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { click = 1; } - else if (event->type == MINUSKEY && event->val == KM_PRESS) { + else if (event->type == EVT_MINUSKEY && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); data->value = -data->value; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -4935,7 +4936,7 @@ static int ui_do_but_NUM( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -5214,7 +5215,7 @@ static int ui_do_but_SLI( click = 2; } else if (event->val == KM_PRESS) { - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->ctrl) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } @@ -5238,10 +5239,10 @@ static int ui_do_but_SLI( button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); retval = WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS) { + else if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { click = 1; } - else if (event->type == MINUSKEY && event->val == KM_PRESS) { + else if (event->type == EVT_MINUSKEY && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); data->value = -data->value; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -5253,7 +5254,7 @@ static int ui_do_but_SLI( #endif } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -5420,7 +5421,7 @@ static int ui_do_but_SCROLL( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -5472,7 +5473,7 @@ static int ui_do_but_GRIP( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -5505,7 +5506,7 @@ static int ui_do_but_LISTROW(bContext *C, /* hack to pass on ctrl+click and double click to overlapping text * editing field for editing list item names */ - if ((ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS && + if ((ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS && event->ctrl) || (event->type == LEFTMOUSE && event->val == KM_DBL_CLICK)) { uiBut *labelbut = ui_but_list_row_text_activate( @@ -5543,7 +5544,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co } #endif /* regular open menu */ - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } @@ -5716,7 +5717,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co } #endif /* regular open menu */ - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { ui_palette_set_active(but); button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; @@ -5748,7 +5749,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co ui_apply_but(C, but->block, but, data, true); return WM_UI_HANDLER_BREAK; } - else if ((int)(but->a1) == UI_PALETTE_COLOR && event->type == DELKEY && + else if ((int)(but->a1) == UI_PALETTE_COLOR && event->type == EVT_DELKEY && event->val == KM_PRESS) { Palette *palette = (Palette *)but->rnapoin.owner_id; PaletteColor *color = but->rnapoin.data; @@ -5874,7 +5875,7 @@ static int ui_do_but_UNITVEC( } } } - else if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + else if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -6167,7 +6168,7 @@ static int ui_do_but_HSVCUBE( } #endif /* WITH_INPUT_NDOF */ /* XXX hardcoded keymap check.... */ - else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) { + else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) { if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) { int len; @@ -6199,7 +6200,7 @@ static int ui_do_but_HSVCUBE( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -6443,7 +6444,7 @@ static int ui_do_but_HSVCIRCLE( } #endif /* WITH_INPUT_NDOF */ /* XXX hardcoded keymap check.... */ - else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) { + else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) { int len; /* reset only saturation */ @@ -6474,7 +6475,7 @@ static int ui_do_but_HSVCIRCLE( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -6598,7 +6599,7 @@ static int ui_do_but_COLORBAND( else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (ELEM(event->type, ESCKEY, RIGHTMOUSE)) { + else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) { if (event->val == KM_PRESS) { data->dragcbd->pos = data->dragfstart; BKE_colorband_update_sort(data->coba); @@ -7024,7 +7025,7 @@ static int ui_do_but_CURVEPROFILE( ui_window_to_block(data->region, block, &mx, &my); /* Move selected control points. */ - if (event->type == GKEY && event->val == KM_RELEASE) { + if (event->type == EVT_GKEY && event->val == KM_RELEASE) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -7036,7 +7037,7 @@ static int ui_do_but_CURVEPROFILE( CurveProfile *profile = (CurveProfile *)but->poin; /* Delete selected control points. */ - if (event->type == XKEY && event->val == KM_RELEASE) { + if (event->type == EVT_XKEY && event->val == KM_RELEASE) { BKE_curveprofile_remove_by_flag(profile, PROF_SELECT); BKE_curveprofile_update(profile, false); button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -7213,7 +7214,7 @@ static int ui_do_but_HISTOGRAM( return WM_UI_HANDLER_BREAK; } /* XXX hardcoded keymap check.... */ - else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) { + else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) { Histogram *hist = (Histogram *)but->poin; hist->ymax = 1.f; @@ -7222,7 +7223,7 @@ static int ui_do_but_HISTOGRAM( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -7289,7 +7290,7 @@ static int ui_do_but_WAVEFORM( return WM_UI_HANDLER_BREAK; } /* XXX hardcoded keymap check.... */ - else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) { + else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) { Scopes *scopes = (Scopes *)but->poin; scopes->wavefrm_yfac = 1.f; @@ -7298,7 +7299,7 @@ static int ui_do_but_WAVEFORM( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -7384,7 +7385,7 @@ static int ui_do_but_TRACKPREVIEW( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -7428,8 +7429,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /* handle copy and paste */ bool is_press_ctrl_but_no_shift = event->val == KM_PRESS && IS_EVENT_MOD(event, ctrl, oskey) && !event->shift; - bool do_copy = event->type == CKEY && is_press_ctrl_but_no_shift; - bool do_paste = event->type == VKEY && is_press_ctrl_but_no_shift; + bool do_copy = event->type == EVT_CKEY && is_press_ctrl_but_no_shift; + bool do_paste = event->type == EVT_VKEY && is_press_ctrl_but_no_shift; /* Specific handling for listrows, we try to find their overlapping tex button. */ if ((do_copy || do_paste) && but->type == UI_BTYPE_LISTROW) { @@ -7470,7 +7471,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * } if ((data->state == BUTTON_STATE_HIGHLIGHT) && - ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY) && + ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, EVT_PADENTER, EVT_RETKEY) && (event->val == KM_RELEASE) && /* Only returns true if the event was handled. */ ui_do_but_extra_operator_icon(C, but, data, event)) { @@ -7602,7 +7603,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * data = but->active; if (data && data->state == BUTTON_STATE_HIGHLIGHT) { if ((retval == WM_UI_HANDLER_CONTINUE) && - (event->type == BACKSPACEKEY && event->val == KM_PRESS)) { + (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS)) { /* ctrl+backspace = reset active button; backspace = reset a whole array*/ ui_but_default_set(C, !event->ctrl, true); ED_region_tag_redraw(data->region); @@ -8896,7 +8897,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *regi } if (val == KM_PRESS) { - if ((ELEM(type, UPARROWKEY, DOWNARROWKEY) && !IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) || + if ((ELEM(type, EVT_UPARROWKEY, EVT_DOWNARROWKEY) && + !IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) || ((ELEM(type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->ctrl && !IS_EVENT_MOD(event, shift, alt, oskey)))) { const int value_orig = RNA_property_int_get(&listbox->rnapoin, listbox->rnaprop); @@ -8905,10 +8907,10 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *regi /* activate up/down the list */ value = value_orig; if ((ui_list->filter_sort_flag & UILST_FLT_SORT_REVERSE) != 0) { - inc = ELEM(type, UPARROWKEY, WHEELUPMOUSE) ? 1 : -1; + inc = ELEM(type, EVT_UPARROWKEY, WHEELUPMOUSE) ? 1 : -1; } else { - inc = ELEM(type, UPARROWKEY, WHEELUPMOUSE) ? -1 : 1; + inc = ELEM(type, EVT_UPARROWKEY, WHEELUPMOUSE) ? -1 : 1; } if (dyn_data->items_filter_neworder || dyn_data->items_filter_flags) { @@ -9563,7 +9565,7 @@ static int ui_handle_menu_event(bContext *C, break; /* Closing sub-levels of pull-downs. */ - case LEFTARROWKEY: + case EVT_LEFTARROWKEY: if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) { if (block->saferct.first) { menu->menuretval = UI_RETURN_OUT; @@ -9574,7 +9576,7 @@ static int ui_handle_menu_event(bContext *C, break; /* Opening sub-levels of pull-downs. */ - case RIGHTARROWKEY: + case EVT_RIGHTARROWKEY: if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) { if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) { @@ -9630,12 +9632,12 @@ static int ui_handle_menu_event(bContext *C, } ATTR_FALLTHROUGH; } - case UPARROWKEY: - case DOWNARROWKEY: - case PAGEUPKEY: - case PAGEDOWNKEY: - case HOMEKEY: - case ENDKEY: + case EVT_UPARROWKEY: + case EVT_DOWNARROWKEY: + case EVT_PAGEUPKEY: + case EVT_PAGEDOWNKEY: + case EVT_HOMEKEY: + case EVT_ENDKEY: /* arrowkeys: only handle for block_loop blocks */ if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) { /* pass */ @@ -9654,13 +9656,13 @@ static int ui_handle_menu_event(bContext *C, uiMenuScrollType scrolltype; bool ui_block_flipped = (block->flag & UI_BLOCK_IS_FLIP) != 0; - if (ELEM(type, PAGEUPKEY, HOMEKEY)) { + if (ELEM(type, EVT_PAGEUPKEY, EVT_HOMEKEY)) { scrolltype = ui_block_flipped ? MENU_SCROLL_TOP : MENU_SCROLL_BOTTOM; } - else if (ELEM(type, PAGEDOWNKEY, ENDKEY)) { + else if (ELEM(type, EVT_PAGEDOWNKEY, EVT_ENDKEY)) { scrolltype = ui_block_flipped ? MENU_SCROLL_BOTTOM : MENU_SCROLL_TOP; } - else if (ELEM(type, UPARROWKEY, WHEELUPMOUSE)) { + else if (ELEM(type, EVT_UPARROWKEY, WHEELUPMOUSE)) { scrolltype = ui_block_flipped ? MENU_SCROLL_UP : MENU_SCROLL_DOWN; } else { @@ -9709,60 +9711,60 @@ static int ui_handle_menu_event(bContext *C, break; - case ONEKEY: - case PAD1: + case EVT_ONEKEY: + case EVT_PAD1: act = 1; ATTR_FALLTHROUGH; - case TWOKEY: - case PAD2: + case EVT_TWOKEY: + case EVT_PAD2: if (act == 0) { act = 2; } ATTR_FALLTHROUGH; - case THREEKEY: - case PAD3: + case EVT_THREEKEY: + case EVT_PAD3: if (act == 0) { act = 3; } ATTR_FALLTHROUGH; - case FOURKEY: - case PAD4: + case EVT_FOURKEY: + case EVT_PAD4: if (act == 0) { act = 4; } ATTR_FALLTHROUGH; - case FIVEKEY: - case PAD5: + case EVT_FIVEKEY: + case EVT_PAD5: if (act == 0) { act = 5; } ATTR_FALLTHROUGH; - case SIXKEY: - case PAD6: + case EVT_SIXKEY: + case EVT_PAD6: if (act == 0) { act = 6; } ATTR_FALLTHROUGH; - case SEVENKEY: - case PAD7: + case EVT_SEVENKEY: + case EVT_PAD7: if (act == 0) { act = 7; } ATTR_FALLTHROUGH; - case EIGHTKEY: - case PAD8: + case EVT_EIGHTKEY: + case EVT_PAD8: if (act == 0) { act = 8; } ATTR_FALLTHROUGH; - case NINEKEY: - case PAD9: + case EVT_NINEKEY: + case EVT_PAD9: if (act == 0) { act = 9; } ATTR_FALLTHROUGH; - case ZEROKEY: - case PAD0: + case EVT_ZEROKEY: + case EVT_PAD0: if (act == 0) { act = 10; } @@ -9823,32 +9825,32 @@ static int ui_handle_menu_event(bContext *C, break; /* Handle keystrokes on menu items */ - case AKEY: - case BKEY: - case CKEY: - case DKEY: - case EKEY: - case FKEY: - case GKEY: - case HKEY: - case IKEY: - case JKEY: - case KKEY: - case LKEY: - case MKEY: - case NKEY: - case OKEY: - case PKEY: - case QKEY: - case RKEY: - case SKEY: - case TKEY: - case UKEY: - case VKEY: - case WKEY: - case XKEY: - case YKEY: - case ZKEY: { + case EVT_AKEY: + case EVT_BKEY: + case EVT_CKEY: + case EVT_DKEY: + case EVT_EKEY: + case EVT_FKEY: + case EVT_GKEY: + case EVT_HKEY: + case EVT_IKEY: + case EVT_JKEY: + case EVT_KKEY: + case EVT_LKEY: + case EVT_MKEY: + case EVT_NKEY: + case EVT_OKEY: + case EVT_PKEY: + case EVT_QKEY: + case EVT_RKEY: + case EVT_SKEY: + case EVT_TKEY: + case EVT_UKEY: + case EVT_VKEY: + case EVT_WKEY: + case EVT_XKEY: + case EVT_YKEY: + case EVT_ZKEY: { if ((event->val == KM_PRESS || event->val == KM_DBL_CLICK) && !IS_EVENT_MOD(event, shift, ctrl, oskey)) { if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) { @@ -9930,11 +9932,11 @@ static int ui_handle_menu_event(bContext *C, retval = WM_UI_HANDLER_BREAK; } #endif - else if (event->type == ESCKEY && event->val == KM_PRESS) { + else if (event->type == EVT_ESCKEY && event->val == KM_PRESS) { /* Escape cancels this and all preceding menus. */ menu->menuretval = UI_RETURN_CANCEL; } - else if (ELEM(event->type, RETKEY, PADENTER) && event->val == KM_PRESS) { + else if (ELEM(event->type, EVT_RETKEY, EVT_PADENTER) && event->val == KM_PRESS) { uiBut *but_default = ui_region_find_first_but_test_flag( region, UI_BUT_ACTIVE_DEFAULT, UI_HIDDEN); if ((but_default != NULL) && (but_default->active == NULL)) { @@ -10367,37 +10369,37 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle } break; - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: menu->menuretval = UI_RETURN_CANCEL; break; - case AKEY: - case BKEY: - case CKEY: - case DKEY: - case EKEY: - case FKEY: - case GKEY: - case HKEY: - case IKEY: - case JKEY: - case KKEY: - case LKEY: - case MKEY: - case NKEY: - case OKEY: - case PKEY: - case QKEY: - case RKEY: - case SKEY: - case TKEY: - case UKEY: - case VKEY: - case WKEY: - case XKEY: - case YKEY: - case ZKEY: { + case EVT_AKEY: + case EVT_BKEY: + case EVT_CKEY: + case EVT_DKEY: + case EVT_EKEY: + case EVT_FKEY: + case EVT_GKEY: + case EVT_HKEY: + case EVT_IKEY: + case EVT_JKEY: + case EVT_KKEY: + case EVT_LKEY: + case EVT_MKEY: + case EVT_NKEY: + case EVT_OKEY: + case EVT_PKEY: + case EVT_QKEY: + case EVT_RKEY: + case EVT_SKEY: + case EVT_TKEY: + case EVT_UKEY: + case EVT_VKEY: + case EVT_WKEY: + case EVT_XKEY: + case EVT_YKEY: + case EVT_ZKEY: { if ((event->val == KM_PRESS || event->val == KM_DBL_CLICK) && !IS_EVENT_MOD(event, shift, ctrl, oskey)) { for (but = block->buttons.first; but; but = but->next) { @@ -10410,8 +10412,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle } #define CASE_NUM_TO_DIR(n, d) \ - case (ZEROKEY + n): \ - case (PAD0 + n): { \ + case (EVT_ZEROKEY + n): \ + case (EVT_PAD0 + n): { \ if (num_dir == UI_RADIAL_NONE) \ num_dir = d; \ } \ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 3173c962830..1984372f398 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -567,14 +567,14 @@ static DrawInfo *g_di_event_list = NULL; int UI_icon_from_event_type(short event_type, short event_value) { - if (event_type == RIGHTSHIFTKEY) { - event_type = LEFTSHIFTKEY; + if (event_type == EVT_RIGHTSHIFTKEY) { + event_type = EVT_LEFTSHIFTKEY; } - else if (event_type == RIGHTCTRLKEY) { - event_type = LEFTCTRLKEY; + else if (event_type == EVT_RIGHTCTRLKEY) { + event_type = EVT_LEFTCTRLKEY; } - else if (event_type == RIGHTALTKEY) { - event_type = LEFTALTKEY; + else if (event_type == EVT_RIGHTALTKEY) { + event_type = EVT_LEFTALTKEY; } else if (event_type == EVT_TWEAK_L) { event_type = LEFTMOUSE; @@ -648,54 +648,54 @@ static void init_event_icons(void) const int w = 16; /* DUMMY */ - INIT_EVENT_ICON(ICON_EVENT_A, AKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_B, BKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_C, CKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_D, DKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_E, EKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F, FKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_G, GKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_H, HKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_I, IKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_J, JKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_K, KKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_L, LKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_M, MKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_N, NKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_O, OKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_P, PKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_Q, QKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_R, RKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_S, SKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_T, TKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_U, UKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_V, VKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_W, WKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_X, XKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_Y, YKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_Z, ZKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_SHIFT, LEFTSHIFTKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_CTRL, LEFTCTRLKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_ALT, LEFTALTKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_OS, OSKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F1, F1KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F2, F2KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F3, F3KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F4, F4KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F5, F5KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F6, F6KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F7, F7KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F8, F8KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F9, F9KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F10, F10KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F11, F11KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F12, F12KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_ESC, ESCKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_TAB, TABKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_PAGEUP, PAGEUPKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_PAGEDOWN, PAGEDOWNKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_RETURN, RETKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_SPACEKEY, SPACEKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_A, EVT_AKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_B, EVT_BKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_C, EVT_CKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_D, EVT_DKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_E, EVT_EKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F, EVT_FKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_G, EVT_GKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_H, EVT_HKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_I, EVT_IKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_J, EVT_JKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_K, EVT_KKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_L, EVT_LKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_M, EVT_MKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_N, EVT_NKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_O, EVT_OKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_P, EVT_PKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_Q, EVT_QKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_R, EVT_RKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_S, EVT_SKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_T, EVT_TKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_U, EVT_UKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_V, EVT_VKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_W, EVT_WKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_X, EVT_XKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_Y, EVT_YKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_Z, EVT_ZKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_SHIFT, EVT_LEFTSHIFTKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_CTRL, EVT_LEFTCTRLKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_ALT, EVT_LEFTALTKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_OS, EVT_OSKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F1, EVT_F1KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F2, EVT_F2KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F3, EVT_F3KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F4, EVT_F4KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F5, EVT_F5KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F6, EVT_F6KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F7, EVT_F7KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F8, EVT_F8KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F9, EVT_F9KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F10, EVT_F10KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F11, EVT_F11KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F12, EVT_F12KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_ESC, EVT_ESCKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_TAB, EVT_TABKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_PAGEUP, EVT_PAGEUPKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_PAGEDOWN, EVT_PAGEDOWNKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_RETURN, EVT_RETKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_SPACEKEY, EVT_SPACEKEY, KM_ANY); g_di_event_list = di_next; diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c index 9a967c3b8f3..9398d1c0cd4 100644 --- a/source/blender/editors/interface/interface_icons_event.c +++ b/source/blender/editors/interface/interface_icons_event.c @@ -142,19 +142,19 @@ void icon_draw_rect_input(float x, .ymax = y + h, }; - if ((event_type >= AKEY) && (event_type <= ZKEY)) { - char str[2] = {'A' + (event_type - AKEY), '\0'}; + if ((event_type >= EVT_AKEY) && (event_type <= EVT_ZKEY)) { + char str[2] = {'A' + (event_type - EVT_AKEY), '\0'}; icon_draw_rect_input_text(&rect, color, str, 13); } - else if ((event_type >= F1KEY) && (event_type <= F12KEY)) { + else if ((event_type >= EVT_F1KEY) && (event_type <= EVT_F12KEY)) { char str[4]; - SNPRINTF(str, "F%d", 1 + (event_type - F1KEY)); - icon_draw_rect_input_text(&rect, color, str, event_type > F9KEY ? 8 : 10); + SNPRINTF(str, "F%d", 1 + (event_type - EVT_F1KEY)); + icon_draw_rect_input_text(&rect, color, str, event_type > EVT_F9KEY ? 8 : 10); } - else if (event_type == LEFTSHIFTKEY) { + else if (event_type == EVT_LEFTSHIFTKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x87, 0xa7, 0x0}); } - else if (event_type == LEFTCTRLKEY) { + else if (event_type == EVT_LEFTCTRLKEY) { if (platform == MACOS) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8c, 0x83, 0x0}); } @@ -162,7 +162,7 @@ void icon_draw_rect_input(float x, icon_draw_rect_input_text(&rect, color, "Ctrl", 9); } } - else if (event_type == LEFTALTKEY) { + else if (event_type == EVT_LEFTALTKEY) { if (platform == MACOS) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8c, 0xa5, 0x0}); } @@ -170,7 +170,7 @@ void icon_draw_rect_input(float x, icon_draw_rect_input_text(&rect, color, "Alt", 10); } } - else if (event_type == OSKEY) { + else if (event_type == EVT_OSKEY) { if (platform == MACOS) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8c, 0x98, 0x0}); } @@ -181,22 +181,22 @@ void icon_draw_rect_input(float x, icon_draw_rect_input_text(&rect, color, "OS", 10); } } - else if (event_type == DELKEY) { + else if (event_type == EVT_DELKEY) { icon_draw_rect_input_text(&rect, color, "Del", 9); } - else if (event_type == TABKEY) { + else if (event_type == EVT_TABKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0xad, 0xbe, 0x0}); } - else if (event_type == HOMEKEY) { + else if (event_type == EVT_HOMEKEY) { icon_draw_rect_input_text(&rect, color, "Home", 6); } - else if (event_type == ENDKEY) { + else if (event_type == EVT_ENDKEY) { icon_draw_rect_input_text(&rect, color, "End", 8); } - else if (event_type == RETKEY) { + else if (event_type == EVT_RETKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8f, 0x8e, 0x0}); } - else if (event_type == ESCKEY) { + else if (event_type == EVT_ESCKEY) { if (platform == MACOS) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8e, 0x8b, 0x0}); } @@ -204,25 +204,25 @@ void icon_draw_rect_input(float x, icon_draw_rect_input_text(&rect, color, "Esc", 8); } } - else if (event_type == PAGEUPKEY) { + else if (event_type == EVT_PAGEUPKEY) { icon_draw_rect_input_text(&rect, color, (const char[]){'P', 0xe2, 0x86, 0x91, 0x0}, 8); } - else if (event_type == PAGEDOWNKEY) { + else if (event_type == EVT_PAGEDOWNKEY) { icon_draw_rect_input_text(&rect, color, (const char[]){'P', 0xe2, 0x86, 0x93, 0x0}, 8); } - else if (event_type == LEFTARROWKEY) { + else if (event_type == EVT_LEFTARROWKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x86, 0x90, 0x0}); } - else if (event_type == UPARROWKEY) { + else if (event_type == EVT_UPARROWKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x86, 0x91, 0x0}); } - else if (event_type == RIGHTARROWKEY) { + else if (event_type == EVT_RIGHTARROWKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x86, 0x92, 0x0}); } - else if (event_type == DOWNARROWKEY) { + else if (event_type == EVT_DOWNARROWKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x86, 0x93, 0x0}); } - else if (event_type == SPACEKEY) { + else if (event_type == EVT_SPACEKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x90, 0xa3, 0x0}); } } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 1f5855aed9e..6e56dd96cb0 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1584,13 +1584,13 @@ static void ui_handle_panel_header( /* XXX weak code, currently it assumes layout style for location of widgets */ /* check open/collapsed button */ - if (event == RETKEY) { + if (event == EVT_RETKEY) { button = 1; } - else if (event == AKEY) { + else if (event == EVT_AKEY) { button = 1; } - else if (ELEM(event, 0, RETKEY, LEFTMOUSE) && shift) { + else if (ELEM(event, 0, EVT_RETKEY, LEFTMOUSE) && shift) { if (block->panel->type->parent == NULL) { block->panel->flag ^= PNL_PIN; button = 2; @@ -2305,7 +2305,7 @@ int ui_handler_panel_region(bContext *C, retval = WM_UI_HANDLER_BREAK; } } - else if ((event->type == TABKEY && event->ctrl) || + else if ((event->type == EVT_TABKEY && event->ctrl) || ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) { /* cycle tabs */ retval = ui_handle_panel_category_cycling(event, region, active_but); @@ -2340,7 +2340,8 @@ int ui_handler_panel_region(bContext *C, /* XXX hardcoded key warning */ if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER) && event->val == KM_PRESS) { - if (event->type == AKEY && ((event->ctrl + event->oskey + event->shift + event->alt) == 0)) { + if (event->type == EVT_AKEY && + ((event->ctrl + event->oskey + event->shift + event->alt) == 0)) { if (pa->flag & PNL_CLOSEDY) { if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my)) { @@ -2366,9 +2367,9 @@ int ui_handler_panel_region(bContext *C, if (event->val == KM_PRESS) { /* open close on header */ - if (ELEM(event->type, RETKEY, PADENTER)) { + if (ELEM(event->type, EVT_RETKEY, EVT_PADENTER)) { if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) { - ui_handle_panel_header(C, block, mx, my, RETKEY, event->ctrl, event->shift); + ui_handle_panel_header(C, block, mx, my, EVT_RETKEY, event->ctrl, event->shift); retval = WM_UI_HANDLER_BREAK; break; } @@ -2395,7 +2396,7 @@ int ui_handler_panel_region(bContext *C, break; } } - else if (event->type == ESCKEY) { + else if (event->type == EVT_ESCKEY) { /*XXX 2.50*/ #if 0 if (block->handler) { @@ -2405,7 +2406,7 @@ int ui_handler_panel_region(bContext *C, } #endif } - else if (event->type == PADPLUSKEY || event->type == PADMINUS) { + else if (event->type == EVT_PADPLUSKEY || event->type == EVT_PADMINUS) { #if 0 /* XXX make float panel exception? */ int zoom = 0; diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index 89eb0658d5e..b10d5be5136 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -283,11 +283,11 @@ void ui_searchbox_event(bContext *C, ARegion *region, uiBut *but, const wmEvent switch (type) { case WHEELUPMOUSE: - case UPARROWKEY: + case EVT_UPARROWKEY: ui_searchbox_select(C, region, but, -1); break; case WHEELDOWNMOUSE: - case DOWNARROWKEY: + case EVT_DOWNARROWKEY: ui_searchbox_select(C, region, but, 1); break; case MOUSEMOVE: diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 2c9803d1dd3..8116029af59 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -306,7 +306,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event) } #endif default: - if (event->type == vpd->invoke_event || event->type == ESCKEY) { + if (event->type == vpd->invoke_event || event->type == EVT_ESCKEY) { if (event->val == KM_RELEASE) { /* calculate overall delta mouse-movement for redo */ RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); @@ -1244,7 +1244,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event /* apply zooming */ view_zoomdrag_apply(C, op); } - else if (event->type == vzd->invoke_event || event->type == ESCKEY) { + else if (event->type == vzd->invoke_event || event->type == EVT_ESCKEY) { if (event->val == KM_RELEASE) { /* for redo, store the overall deltas - need to respect zoom-locks here... */ diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 50f7466f7ed..4d3283e608b 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -932,11 +932,11 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event) float co[2]; switch (event->type) { - case LEFTALTKEY: - case RIGHTALTKEY: - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: - if (ELEM(event->type, LEFTALTKEY, RIGHTALTKEY)) { + case EVT_LEFTALTKEY: + case EVT_RIGHTALTKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: + if (ELEM(event->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY)) { if (data->action == SLIDE_ACTION_FEATHER) { data->is_overall_feather = (event->val == KM_PRESS); } @@ -945,7 +945,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event) } } - if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) { + if (ELEM(event->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) { data->is_accurate = (event->val == KM_PRESS); } @@ -1165,7 +1165,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event) break; } - case ESCKEY: + case EVT_ESCKEY: cancel_slide_point(op->customdata); WM_event_add_notifier(C, NC_MASK | NA_EDITED, data->mask); @@ -1419,15 +1419,15 @@ static int slide_spline_curvature_modal(bContext *C, wmOperator *op, const wmEve float u = slide_data->u; switch (event->type) { - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: - case LEFTCTRLKEY: - case RIGHTCTRLKEY: - if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) { + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: + if (ELEM(event->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) { slide_data->accurate = (event->val == KM_PRESS); } - if (ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY)) { + if (ELEM(event->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) { if (event->val == KM_PRESS) { slide_data->adjust_bezt->h1 = slide_data->adjust_bezt->h2 = HD_FREE; if ((u > margin && u < 0.5f) || (u >= 0.5f && u < 1.0f - margin)) { @@ -1551,7 +1551,7 @@ static int slide_spline_curvature_modal(bContext *C, wmOperator *op, const wmEve break; - case ESCKEY: + case EVT_ESCKEY: cancel_slide_spline_curvature(slide_data); WM_event_add_notifier(C, NC_MASK | NA_EDITED, slide_data->mask); diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index 23a108e816a..ea1942dee5f 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -401,7 +401,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) else { bool handled = false; switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: edbm_inset_cancel(C, op); return OPERATOR_CANCELLED; @@ -450,8 +450,8 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) break; case LEFTMOUSE: - case PADENTER: - case RETKEY: + case EVT_PADENTER: + case EVT_RETKEY: if ((event->val == KM_PRESS) || ((event->val == KM_RELEASE) && RNA_boolean_get(op->ptr, "release_confirm"))) { edbm_inset_calc(op); @@ -459,8 +459,8 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } break; - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: if (event->val == KM_PRESS) { if (opdata->modify_depth) { opdata->shift_amount = RNA_float_get(op->ptr, "depth"); @@ -478,8 +478,8 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) } break; - case LEFTCTRLKEY: - case RIGHTCTRLKEY: { + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: { float mlen[2]; mlen[0] = opdata->mcenter[0] - event->mval[0]; @@ -506,7 +506,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) break; } - case OKEY: + case EVT_OKEY: if (event->val == KM_PRESS) { const bool use_outset = RNA_boolean_get(op->ptr, "use_outset"); RNA_boolean_set(op->ptr, "use_outset", !use_outset); @@ -520,7 +520,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) handled = true; } break; - case BKEY: + case EVT_BKEY: if (event->val == KM_PRESS) { const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary"); RNA_boolean_set(op->ptr, "use_boundary", !use_boundary); @@ -534,7 +534,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) handled = true; } break; - case IKEY: + case EVT_IKEY: if (event->val == KM_PRESS) { const bool use_individual = RNA_boolean_get(op->ptr, "use_individual"); RNA_boolean_set(op->ptr, "use_individual", !use_individual); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 9509a0af2bc..066b692e1ff 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -536,8 +536,8 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) else { bool handled = false; switch (event->type) { - case RETKEY: - case PADENTER: + case EVT_RETKEY: + case EVT_PADENTER: case LEFTMOUSE: /* confirm */ // XXX hardcoded if (event->val == KM_PRESS) { return loopcut_finish(lcd, C, op); @@ -552,7 +552,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) ED_workspace_status_text(C, NULL); return OPERATOR_CANCELLED; - case ESCKEY: + case EVT_ESCKEY: if (event->val == KM_RELEASE) { /* cancel */ ED_region_tag_redraw(lcd->region); @@ -577,8 +577,8 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) } handled = true; break; - case PADPLUSKEY: - case PAGEUPKEY: + case EVT_PADPLUSKEY: + case EVT_PAGEUPKEY: case WHEELUPMOUSE: /* change number of cuts */ if (event->val == KM_RELEASE) { break; @@ -591,8 +591,8 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) } handled = true; break; - case PADMINUS: - case PAGEDOWNKEY: + case EVT_PADMINUS: + case EVT_PAGEDOWNKEY: case WHEELDOWNMOUSE: /* change number of cuts */ if (event->val == KM_RELEASE) { break; diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index bc79521ee9b..6f659858ac2 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -596,7 +596,7 @@ static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), const /* running render */ switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: return OPERATOR_RUNNING_MODAL; } return OPERATOR_PASS_THROUGH; diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 46df7e6e1d4..8cfcad2d77e 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -143,7 +143,7 @@ static int bake_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) /* running render */ switch (event->type) { - case ESCKEY: { + case EVT_ESCKEY: { G.is_break = true; return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 3b1fb49c383..4a085bb61bf 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1995,7 +1995,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const } } else { - if (ELEM(event->type, LEFTMOUSE, RETKEY, PADENTER)) { + if (ELEM(event->type, LEFTMOUSE, EVT_RETKEY, EVT_PADENTER)) { is_finished = true; } } @@ -2004,7 +2004,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const object_transform_axis_target_free_data(op); return OPERATOR_FINISHED; } - else if (ELEM(event->type, ESCKEY, RIGHTMOUSE)) { + else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) { object_transform_axis_target_cancel(C, op); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 2db5eb784c0..0b754780cde 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -606,7 +606,7 @@ static int fluid_bake_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent * } switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: return OPERATOR_RUNNING_MODAL; } return OPERATOR_PASS_THROUGH; diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index f37d2cf9a76..f687120d228 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -844,7 +844,7 @@ static int screen_render_modal(bContext *C, wmOperator *op, const wmEvent *event /* running render */ switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: return OPERATOR_RUNNING_MODAL; } return OPERATOR_PASS_THROUGH; diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index c48d5917ec2..6baf8cdba07 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -1222,7 +1222,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent bool ret; switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: /* cancel */ oglrender->pool_ok = false; /* Flag pool for cancel. */ screen_opengl_render_end(C, op->customdata); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 95d044554f1..d022de0545f 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -918,7 +918,7 @@ static int light_cache_bake_modal(bContext *C, wmOperator *op, const wmEvent *ev /* running render */ switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: return OPERATOR_RUNNING_MODAL; } return OPERATOR_PASS_THROUGH; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a72b18f63f8..2fe34d61a04 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1090,7 +1090,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) } break; } - case ESCKEY: + case EVT_ESCKEY: actionzone_exit(op); return OPERATOR_CANCELLED; case LEFTMOUSE: @@ -1270,7 +1270,7 @@ static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event) } break; - case ESCKEY: + case EVT_ESCKEY: area_swap_cancel(C, op); return OPERATOR_CANCELLED; } @@ -2335,7 +2335,7 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) break; case MIDDLEMOUSE: - case TABKEY: + case EVT_TABKEY: if (sd->previewmode == 0) { /* pass */ } @@ -2353,11 +2353,11 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) break; case RIGHTMOUSE: /* cancel operation */ - case ESCKEY: + case EVT_ESCKEY: area_split_cancel(C, op); return OPERATOR_CANCELLED; - case LEFTCTRLKEY: + case EVT_LEFTCTRLKEY: sd->do_snap = event->val == KM_PRESS; update_factor = true; break; @@ -2757,7 +2757,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) } break; - case ESCKEY: + case EVT_ESCKEY: break; } @@ -3473,7 +3473,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) break; case RIGHTMOUSE: - case ESCKEY: + case EVT_ESCKEY: area_join_cancel(C, op); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index fed3c2f03a4..6f0ee3626e4 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -1013,14 +1013,14 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve case MOUSEMOVE: stencil_control_calculate(scd, event->mval); break; - case ESCKEY: + case EVT_ESCKEY: if (event->val == KM_PRESS) { stencil_control_cancel(C, op); WM_event_add_notifier(C, NC_WINDOW, NULL); return OPERATOR_CANCELLED; } break; - case XKEY: + case EVT_XKEY: if (event->val == KM_PRESS) { if (scd->constrain_mode == STENCIL_CONSTRAINT_X) { @@ -1033,7 +1033,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve stencil_control_calculate(scd, event->mval); } break; - case YKEY: + case EVT_YKEY: if (event->val == KM_PRESS) { if (scd->constrain_mode == STENCIL_CONSTRAINT_Y) { scd->constrain_mode = 0; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index ee114d5f662..0e194e57538 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -1449,7 +1449,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } } - else if (ELEM(event->type, RETKEY, SPACEKEY)) { + else if (ELEM(event->type, EVT_RETKEY, EVT_SPACEKEY)) { paint_stroke_line_end(C, op, stroke, sample_average.mouse); stroke_done(C, op); return OPERATOR_FINISHED; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 14c11523455..1f05b3b944e 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -10067,7 +10067,7 @@ static int sculpt_mask_expand_modal(bContext *C, wmOperator *op, const wmEvent * mask_expand_update_it = ss->filter_cache->mask_update_it[(int)SCULPT_active_vertex_get(ss)]; } - if ((event->type == ESCKEY && event->val == KM_PRESS) || + if ((event->type == EVT_ESCKEY && event->val == KM_PRESS) || (event->type == RIGHTMOUSE && event->val == KM_PRESS)) { /* Returning OPERATOR_CANCELLED will leak memory due to not finishing * undo. Better solution could be to make paint_mesh_restore_co work @@ -10077,8 +10077,8 @@ static int sculpt_mask_expand_modal(bContext *C, wmOperator *op, const wmEvent * } if ((event->type == LEFTMOUSE && event->val == KM_RELEASE) || - (event->type == RETKEY && event->val == KM_PRESS) || - (event->type == PADENTER && event->val == KM_PRESS)) { + (event->type == EVT_RETKEY && event->val == KM_PRESS) || + (event->type == EVT_PADENTER && event->val == KM_PRESS)) { /* Smooth iterations. */ SculptThreadedTaskData data = { @@ -10148,7 +10148,7 @@ static int sculpt_mask_expand_modal(bContext *C, wmOperator *op, const wmEvent * mask_expand_update_it = ss->filter_cache->mask_update_last_it - 1; } - if (!ELEM(event->type, MOUSEMOVE, LEFTCTRLKEY, RIGHTCTRLKEY)) { + if (!ELEM(event->type, MOUSEMOVE, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) { return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index c6033ec6ca0..0f978b38e60 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -484,11 +484,11 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event) RNA_float_set_array(op->ptr, "offset", offset); view_pan_exec(C, op); break; - case ESCKEY: + case EVT_ESCKEY: view_pan_exit(C, op, 1); return OPERATOR_CANCELLED; - case SPACEKEY: + case EVT_SPACEKEY: view_pan_exit(C, op, 0); return OPERATOR_FINISHED; @@ -1136,7 +1136,7 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event) { switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: return OPERATOR_FINISHED; case MOUSEMOVE: @@ -1702,7 +1702,7 @@ static int clip_prefetch_modal(bContext *C, wmOperator *UNUSED(op), const wmEven /* running render */ switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index aab60f8bc6e..3c25be9fe1e 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -189,7 +189,7 @@ static int add_marker_at_click_modal(bContext *C, wmOperator *UNUSED(op), const return OPERATOR_FINISHED; } - case ESCKEY: + case EVT_ESCKEY: ED_workspace_status_text(C, NULL); return OPERATOR_CANCELLED; } @@ -780,17 +780,17 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event) float dx, dy, mdelta[2]; switch (event->type) { - case LEFTCTRLKEY: - case RIGHTCTRLKEY: - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: if (data->action == SLIDE_ACTION_SIZE) { - if (ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY)) { + if (ELEM(event->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) { data->lock = event->val == KM_RELEASE; } } - if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) { + if (ELEM(event->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) { data->accurate = event->val == KM_PRESS; } ATTR_FALLTHROUGH; @@ -966,7 +966,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event) break; - case ESCKEY: + case EVT_ESCKEY: cancel_mouse_slide(op->customdata); free_slide_data(op->customdata); diff --git a/source/blender/editors/space_clip/tracking_ops_plane.c b/source/blender/editors/space_clip/tracking_ops_plane.c index 00861ab0270..329dc8be894 100644 --- a/source/blender/editors/space_clip/tracking_ops_plane.c +++ b/source/blender/editors/space_clip/tracking_ops_plane.c @@ -270,11 +270,11 @@ static int slide_plane_marker_modal(bContext *C, wmOperator *op, const wmEvent * float next_edge[2], prev_edge[2], next_diag_edge[2], prev_diag_edge[2]; switch (event->type) { - case LEFTCTRLKEY: - case RIGHTCTRLKEY: - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: - if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) { + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: + if (ELEM(event->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) { data->accurate = event->val == KM_PRESS; } ATTR_FALLTHROUGH; @@ -363,7 +363,7 @@ static int slide_plane_marker_modal(bContext *C, wmOperator *op, const wmEvent * break; - case ESCKEY: + case EVT_ESCKEY: cancel_mouse_slide_plane_marker(op->customdata); free_slide_plane_marker_data(op->customdata); diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c index da3bf0ea8b3..b6c5c087025 100644 --- a/source/blender/editors/space_clip/tracking_ops_solve.c +++ b/source/blender/editors/space_clip/tracking_ops_solve.c @@ -261,7 +261,7 @@ static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent /* Running solver. */ switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/space_clip/tracking_ops_track.c b/source/blender/editors/space_clip/tracking_ops_track.c index adbb3e30850..f579b2a08e2 100644 --- a/source/blender/editors/space_clip/tracking_ops_track.c +++ b/source/blender/editors/space_clip/tracking_ops_track.c @@ -387,7 +387,7 @@ static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), const wmEven /* Running tracking. */ switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 7580666c5f0..e9f9249e608 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1576,8 +1576,8 @@ static int graphkeys_decimate_modal(bContext *C, wmOperator *op, const wmEvent * switch (event->type) { case LEFTMOUSE: /* confirm */ - case RETKEY: - case PADENTER: { + case EVT_RETKEY: + case EVT_PADENTER: { if (event->val == KM_PRESS) { decimate_exit(C, op); @@ -1586,7 +1586,7 @@ static int graphkeys_decimate_modal(bContext *C, wmOperator *op, const wmEvent * break; } - case ESCKEY: /* cancel */ + case EVT_ESCKEY: /* cancel */ case RIGHTMOUSE: { if (event->val == KM_PRESS) { decimate_reset_bezts(dgo); diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 83aa0aa6eab..344688bbd21 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -176,7 +176,7 @@ static int graphview_cursor_modal(bContext *C, wmOperator *op, const wmEvent *ev /* execute the events */ switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: if (screen) { screen->scrubbing = false; } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index c62fd53431b..395329e5f6e 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -3887,7 +3887,7 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event) { switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: return OPERATOR_FINISHED; case MOUSEMOVE: diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index e88b8a89b09..564d5f9c6b5 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1707,8 +1707,8 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even } case LEFTMOUSE: - case RETKEY: - case SPACEKEY: { + case EVT_RETKEY: + case EVT_SPACEKEY: { MEM_freeN(data->seq_array); MEM_freeN(data->trim); MEM_freeN(data->ts); @@ -1722,7 +1722,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even return OPERATOR_FINISHED; } - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: { int i; Editing *ed = BKE_sequencer_editing_get(scene, false); @@ -1754,8 +1754,8 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even return OPERATOR_CANCELLED; } - case RIGHTSHIFTKEY: - case LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: + case EVT_LEFTSHIFTKEY: if (!has_numInput) { if (event->val == KM_PRESS) { data->slow = true; diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index 97ce7035222..7a74cf9fe80 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -394,7 +394,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e draw = 1; } break; - case ESCKEY: + case EVT_ESCKEY: if (event->val == KM_PRESS) { draw = swallow = 1; if (tools & TOOL_SUGG_LIST) { @@ -410,8 +410,8 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e retval = OPERATOR_CANCELLED; } break; - case RETKEY: - case PADENTER: + case EVT_RETKEY: + case EVT_PADENTER: if (event->val == KM_PRESS) { if (tools & TOOL_SUGG_LIST) { ED_text_undo_push_init(C); @@ -429,8 +429,8 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e retval = OPERATOR_FINISHED; } break; - case LEFTARROWKEY: - case BACKSPACEKEY: + case EVT_LEFTARROWKEY: + case EVT_BACKSPACEKEY: if (event->val == KM_PRESS) { if (tools & TOOL_SUGG_LIST) { if (event->ctrl) { @@ -462,7 +462,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e } } break; - case RIGHTARROWKEY: + case EVT_RIGHTARROWKEY: if (event->val == KM_PRESS) { if (tools & TOOL_SUGG_LIST) { if (event->ctrl) { @@ -494,11 +494,11 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e } } break; - case PAGEDOWNKEY: + case EVT_PAGEDOWNKEY: scroll = SUGG_LIST_SIZE - 1; ATTR_FALLTHROUGH; case WHEELDOWNMOUSE: - case DOWNARROWKEY: + case EVT_DOWNARROWKEY: if (event->val == KM_PRESS) { if (tools & TOOL_DOCUMENT) { doc_scroll++; @@ -528,11 +528,11 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e } } break; - case PAGEUPKEY: + case EVT_PAGEUPKEY: scroll = SUGG_LIST_SIZE - 1; ATTR_FALLTHROUGH; case WHEELUPMOUSE: - case UPARROWKEY: + case EVT_UPARROWKEY: if (event->val == KM_PRESS) { if (tools & TOOL_DOCUMENT) { if (doc_scroll > 0) { @@ -559,8 +559,8 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e } } break; - case RIGHTSHIFTKEY: - case LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: + case EVT_LEFTSHIFTKEY: break; #if 0 default: diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 68d5765e43d..9ae9811c626 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1713,7 +1713,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf) /* items for modal map */ WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM); - WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM); + WM_modalkeymap_add_item(keymap, EVT_ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM); /* disabled mode switching for now, can re-implement better, later on */ #if 0 diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d8700a3dba4..260748ce953 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -788,21 +788,21 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm /* Initialize */ switch (key_type) { - case XKEY: + case EVT_XKEY: msg1 = TIP_("along X"); msg2 = TIP_("along %s X"); msg3 = TIP_("locking %s X"); axis = 'X'; constraint_axis = CON_AXIS0; break; - case YKEY: + case EVT_YKEY: msg1 = TIP_("along Y"); msg2 = TIP_("along %s Y"); msg3 = TIP_("locking %s Y"); axis = 'Y'; constraint_axis = CON_AXIS1; break; - case ZKEY: + case EVT_ZKEY: msg1 = TIP_("along Z"); msg2 = TIP_("along %s Z"); msg3 = TIP_("locking %s Z"); @@ -815,7 +815,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm } constraint_plane = ((CON_AXIS0 | CON_AXIS1 | CON_AXIS2) & (~constraint_axis)); - if (edit_2d && (key_type != ZKEY)) { + if (edit_2d && (key_type != EVT_ZKEY)) { if (cmode == axis) { stopConstraint(t); } @@ -1047,42 +1047,42 @@ int transformEvent(TransInfo *t, const wmEvent *event) break; case TFM_MODAL_AXIS_X: if (!(t->flag & T_NO_CONSTRAINT)) { - transform_event_xyz_constraint(t, XKEY, cmode, false); + transform_event_xyz_constraint(t, EVT_XKEY, cmode, false); t->redraw |= TREDRAW_HARD; handled = true; } break; case TFM_MODAL_AXIS_Y: if ((t->flag & T_NO_CONSTRAINT) == 0) { - transform_event_xyz_constraint(t, YKEY, cmode, false); + transform_event_xyz_constraint(t, EVT_YKEY, cmode, false); t->redraw |= TREDRAW_HARD; handled = true; } break; case TFM_MODAL_AXIS_Z: if ((t->flag & (T_NO_CONSTRAINT)) == 0) { - transform_event_xyz_constraint(t, ZKEY, cmode, false); + transform_event_xyz_constraint(t, EVT_ZKEY, cmode, false); t->redraw |= TREDRAW_HARD; handled = true; } break; case TFM_MODAL_PLANE_X: if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { - transform_event_xyz_constraint(t, XKEY, cmode, true); + transform_event_xyz_constraint(t, EVT_XKEY, cmode, true); t->redraw |= TREDRAW_HARD; handled = true; } break; case TFM_MODAL_PLANE_Y: if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { - transform_event_xyz_constraint(t, YKEY, cmode, true); + transform_event_xyz_constraint(t, EVT_YKEY, cmode, true); t->redraw |= TREDRAW_HARD; handled = true; } break; case TFM_MODAL_PLANE_Z: if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { - transform_event_xyz_constraint(t, ZKEY, cmode, true); + transform_event_xyz_constraint(t, EVT_ZKEY, cmode, true); t->redraw |= TREDRAW_HARD; handled = true; } @@ -1187,15 +1187,15 @@ int transformEvent(TransInfo *t, const wmEvent *event) /* else do non-mapped events */ else if (event->val == KM_PRESS) { switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: t->state = TRANS_CANCEL; handled = true; break; - case SPACEKEY: - case PADENTER: - case RETKEY: + case EVT_SPACEKEY: + case EVT_PADENTER: + case EVT_RETKEY: if (event->is_repeat) { break; } @@ -1204,8 +1204,8 @@ int transformEvent(TransInfo *t, const wmEvent *event) break; /* enforce redraw of transform when modifiers are used */ - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: t->modifiers |= MOD_CONSTRAINT_PLANE; t->redraw |= TREDRAW_HARD; handled = true; @@ -1246,7 +1246,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } break; - case GKEY: + case EVT_GKEY: if (event->is_repeat) { break; } @@ -1261,7 +1261,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } break; - case SKEY: + case EVT_SKEY: if (event->is_repeat) { break; } @@ -1276,7 +1276,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } break; - case RKEY: + case EVT_RKEY: if (event->is_repeat) { break; } @@ -1299,7 +1299,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) } } break; - case CKEY: + case EVT_CKEY: if (event->is_repeat) { break; } @@ -1313,7 +1313,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) } } break; - case OKEY: + case EVT_OKEY: if (event->is_repeat) { break; } @@ -1324,7 +1324,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } break; - case PADPLUSKEY: + case EVT_PADPLUSKEY: if (event->alt && t->flag & T_PROP_EDIT) { t->prop_size *= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f; if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) { @@ -1335,7 +1335,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } break; - case PAGEUPKEY: + case EVT_PAGEUPKEY: case WHEELDOWNMOUSE: if (t->flag & T_AUTOIK) { transform_autoik_update(t, 1); @@ -1346,7 +1346,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) t->redraw = TREDRAW_HARD; handled = true; break; - case PADMINUS: + case EVT_PADMINUS: if (event->alt && t->flag & T_PROP_EDIT) { t->prop_size /= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f; calculatePropRatio(t); @@ -1354,7 +1354,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } break; - case PAGEDOWNKEY: + case EVT_PAGEDOWNKEY: case WHEELUPMOUSE: if (t->flag & T_AUTOIK) { transform_autoik_update(t, -1); @@ -1365,15 +1365,15 @@ int transformEvent(TransInfo *t, const wmEvent *event) t->redraw = TREDRAW_HARD; handled = true; break; - case LEFTALTKEY: - case RIGHTALTKEY: + case EVT_LEFTALTKEY: + case EVT_RIGHTALTKEY: if (ELEM(t->spacetype, SPACE_SEQ, SPACE_VIEW3D)) { t->flag |= T_ALT_TRANSFORM; t->redraw |= TREDRAW_HARD; handled = true; } break; - case NKEY: + case EVT_NKEY: if (event->is_repeat) { break; } @@ -1397,8 +1397,8 @@ int transformEvent(TransInfo *t, const wmEvent *event) } else if (event->val == KM_RELEASE) { switch (event->type) { - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: t->modifiers &= ~MOD_CONSTRAINT_PLANE; t->redraw |= TREDRAW_HARD; handled = true; @@ -1412,8 +1412,8 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } break; - case LEFTALTKEY: - case RIGHTALTKEY: + case EVT_LEFTALTKEY: + case EVT_RIGHTALTKEY: if (ELEM(t->spacetype, SPACE_SEQ, SPACE_VIEW3D)) { t->flag &= ~T_ALT_TRANSFORM; t->redraw |= TREDRAW_HARD; @@ -2060,10 +2060,10 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) { - if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) || - (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) || - (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) || - ((kmi->type == OSKEY) && event->oskey)) { + if ((ELEM(kmi->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY) && event->ctrl) || + (ELEM(kmi->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY) && event->shift) || + (ELEM(kmi->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY) && event->alt) || + ((kmi->type == EVT_OSKEY) && event->oskey)) { t->modifiers |= MOD_SNAP_INVERT; } break; diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index fb929b60739..fc71457171d 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -476,8 +476,8 @@ eRedrawFlag handleMouseInput(TransInfo *t, MouseInput *mi, const wmEvent *event) eRedrawFlag redraw = TREDRAW_NOTHING; switch (event->type) { - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: if (event->val == KM_PRESS) { t->modifiers |= MOD_PRECISION; /* shift is modifier for higher precision transforn */ diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c index fb43d75567c..a012d89d107 100644 --- a/source/blender/editors/transform/transform_mode_edge_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_slide.c @@ -1098,21 +1098,21 @@ static eRedrawFlag handleEventEdgeSlide(struct TransInfo *t, const struct wmEven if (slp) { switch (event->type) { - case EKEY: + case EVT_EKEY: if (event->val == KM_PRESS) { slp->use_even = !slp->use_even; calcEdgeSlideCustomPoints(t); return TREDRAW_HARD; } break; - case FKEY: + case EVT_FKEY: if (event->val == KM_PRESS) { slp->flipped = !slp->flipped; calcEdgeSlideCustomPoints(t); return TREDRAW_HARD; } break; - case CKEY: + case EVT_CKEY: /* use like a modifier key */ if (event->val == KM_PRESS) { t->flag ^= T_ALT_TRANSFORM; diff --git a/source/blender/editors/transform/transform_mode_shear.c b/source/blender/editors/transform/transform_mode_shear.c index f57ae11d121..c3313046a11 100644 --- a/source/blender/editors/transform/transform_mode_shear.c +++ b/source/blender/editors/transform/transform_mode_shear.c @@ -101,13 +101,13 @@ static eRedrawFlag handleEventShear(TransInfo *t, const wmEvent *event) status = TREDRAW_HARD; } - else if (event->type == XKEY && event->val == KM_PRESS) { + else if (event->type == EVT_XKEY && event->val == KM_PRESS) { t->orient_axis_ortho = (t->orient_axis + 1) % 3; initShear_mouseInputMode(t); status = TREDRAW_HARD; } - else if (event->type == YKEY && event->val == KM_PRESS) { + else if (event->type == EVT_YKEY && event->val == KM_PRESS) { t->orient_axis_ortho = (t->orient_axis + 2) % 3; initShear_mouseInputMode(t); diff --git a/source/blender/editors/transform/transform_mode_vert_slide.c b/source/blender/editors/transform/transform_mode_vert_slide.c index ae775b5db24..15f999d37ec 100644 --- a/source/blender/editors/transform/transform_mode_vert_slide.c +++ b/source/blender/editors/transform/transform_mode_vert_slide.c @@ -328,7 +328,7 @@ static eRedrawFlag handleEventVertSlide(struct TransInfo *t, const struct wmEven if (slp) { switch (event->type) { - case EKEY: + case EVT_EKEY: if (event->val == KM_PRESS) { slp->use_even = !slp->use_even; if (slp->flipped) { @@ -337,14 +337,14 @@ static eRedrawFlag handleEventVertSlide(struct TransInfo *t, const struct wmEven return TREDRAW_HARD; } break; - case FKEY: + case EVT_FKEY: if (event->val == KM_PRESS) { slp->flipped = !slp->flipped; calcVertSlideCustomPoints(t); return TREDRAW_HARD; } break; - case CKEY: + case EVT_CKEY: /* use like a modifier key */ if (event->val == KM_PRESS) { t->flag ^= T_ALT_TRANSFORM; diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index ead841642d7..88b1bbe3f4b 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -354,7 +354,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) ascii[0] = event->ascii; } break; - case BACKSPACEKEY: + case EVT_BACKSPACEKEY: /* Part specific to backspace... */ if (!(n->val_flag[idx] & NUM_EDITED)) { copy_v3_v3(n->val, n->val_org); @@ -381,7 +381,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) * only difference is remove char(s) before/after the cursor. */ dir = STRCUR_DIR_PREV; ATTR_FALLTHROUGH; - case DELKEY: + case EVT_DELKEY: if ((n->val_flag[idx] & NUM_EDITED) && n->str[0]) { int t_cur = cur = n->str_cur; if (event->ctrl) { @@ -405,10 +405,10 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) return false; } break; - case LEFTARROWKEY: + case EVT_LEFTARROWKEY: dir = STRCUR_DIR_PREV; ATTR_FALLTHROUGH; - case RIGHTARROWKEY: + case EVT_RIGHTARROWKEY: cur = n->str_cur; if (event->ctrl) { mode = STRCUR_JUMP_DELIM; @@ -419,19 +419,19 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) return true; } return false; - case HOMEKEY: + case EVT_HOMEKEY: if (n->str[0]) { n->str_cur = 0; return true; } return false; - case ENDKEY: + case EVT_ENDKEY: if (n->str[0]) { n->str_cur = strlen(n->str); return true; } return false; - case TABKEY: + case EVT_TABKEY: #ifdef USE_FAKE_EDIT n->val_flag[idx] &= ~(NUM_NEGATE | NUM_INVERSE); #endif @@ -446,8 +446,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) n->str_cur = 0; } return true; - case PADPERIOD: - case PERIODKEY: + case EVT_PADPERIOD: + case EVT_PERIODKEY: /* Force numdot, some OSs/countries generate a comma char in this case, * sic... (T37992) */ ascii[0] = '.'; @@ -473,29 +473,29 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) #endif #ifdef USE_FAKE_EDIT - case PADMINUS: - case MINUSKEY: + case EVT_PADMINUS: + case EVT_MINUSKEY: if (event->ctrl || !(n->flag & NUM_EDIT_FULL)) { n->val_flag[idx] ^= NUM_NEGATE; updated = true; } break; - case PADSLASHKEY: - case SLASHKEY: + case EVT_PADSLASHKEY: + case EVT_SLASHKEY: if (event->ctrl || !(n->flag & NUM_EDIT_FULL)) { n->val_flag[idx] ^= NUM_INVERSE; updated = true; } break; #endif - case CKEY: + case EVT_CKEY: if (event->ctrl) { /* Copy current str to the copypaste buffer. */ WM_clipboard_text_set(n->str, 0); updated = true; } break; - case VKEY: + case EVT_VKEY: if (event->ctrl) { /* extract the first line from the clipboard */ int pbuf_len; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 5544c5cee63..d6652aca216 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -2608,13 +2608,13 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_PASS_THROUGH; /* Cancel */ - case ESCKEY: + case EVT_ESCKEY: stitch_cancel(C, op); return OPERATOR_CANCELLED; case LEFTMOUSE: - case PADENTER: - case RETKEY: + case EVT_PADENTER: + case EVT_RETKEY: if (event->val == KM_PRESS) { if (stitch_process_data(ssc, active_state, scene, true)) { stitch_exit(C, op, 1); @@ -2629,7 +2629,7 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_PASS_THROUGH; } /* Increase limit */ - case PADPLUSKEY: + case EVT_PADPLUSKEY: case WHEELUPMOUSE: if (event->val == KM_PRESS && event->alt) { ssc->limit_dist += 0.01f; @@ -2643,7 +2643,7 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_PASS_THROUGH; } /* Decrease limit */ - case PADMINUS: + case EVT_PADMINUS: case WHEELDOWNMOUSE: if (event->val == KM_PRESS && event->alt) { ssc->limit_dist -= 0.01f; @@ -2659,7 +2659,7 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* Use Limit (Default off) */ - case LKEY: + case EVT_LKEY: if (event->val == KM_PRESS) { ssc->use_limit = !ssc->use_limit; if (!stitch_process_data(ssc, active_state, scene, false)) { @@ -2670,7 +2670,7 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) } return OPERATOR_RUNNING_MODAL; - case IKEY: + case EVT_IKEY: if (event->val == KM_PRESS) { /* Move to next island and maybe next object */ @@ -2694,7 +2694,7 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) } return OPERATOR_RUNNING_MODAL; - case MKEY: + case EVT_MKEY: if (event->val == KM_PRESS) { ssc->midpoints = !ssc->midpoints; if (!stitch_process_data(ssc, active_state, scene, false)) { @@ -2722,7 +2722,7 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; /* snap islands on/off */ - case SKEY: + case EVT_SKEY: if (event->val == KM_PRESS) { ssc->snap_islands = !ssc->snap_islands; if (!stitch_process_data(ssc, active_state, scene, false)) { @@ -2736,7 +2736,7 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* switch between edge/vertex mode */ - case TABKEY: + case EVT_TABKEY: if (event->val == KM_PRESS) { stitch_switch_selection_mode_all(ssc); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index a198ebb6f20..7f42eeb5dd7 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -811,16 +811,16 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev MinStretch *ms = op->customdata; switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: minimize_stretch_exit(C, op, true); return OPERATOR_CANCELLED; - case RETKEY: - case PADENTER: + case EVT_RETKEY: + case EVT_PADENTER: case LEFTMOUSE: minimize_stretch_exit(C, op, false); return OPERATOR_FINISHED; - case PADPLUSKEY: + case EVT_PADPLUSKEY: case WHEELUPMOUSE: if (event->val == KM_PRESS) { if (ms->blend < 0.95f) { @@ -831,7 +831,7 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev } } break; - case PADMINUS: + case EVT_PADMINUS: case WHEELDOWNMOUSE: if (event->val == KM_PRESS) { if (ms->blend > 0.05f) { diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 7cba1c49a9b..515ed2b0743 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -198,128 +198,128 @@ const EnumPropertyItem rna_enum_event_type_items[] = { {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", "TwkM"}, {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", "TwkR"}, {0, "", 0, NULL, NULL}, - {AKEY, "A", 0, "A", ""}, - {BKEY, "B", 0, "B", ""}, - {CKEY, "C", 0, "C", ""}, - {DKEY, "D", 0, "D", ""}, - {EKEY, "E", 0, "E", ""}, - {FKEY, "F", 0, "F", ""}, - {GKEY, "G", 0, "G", ""}, - {HKEY, "H", 0, "H", ""}, - {IKEY, "I", 0, "I", ""}, - {JKEY, "J", 0, "J", ""}, - {KKEY, "K", 0, "K", ""}, - {LKEY, "L", 0, "L", ""}, - {MKEY, "M", 0, "M", ""}, - {NKEY, "N", 0, "N", ""}, - {OKEY, "O", 0, "O", ""}, - {PKEY, "P", 0, "P", ""}, - {QKEY, "Q", 0, "Q", ""}, - {RKEY, "R", 0, "R", ""}, - {SKEY, "S", 0, "S", ""}, - {TKEY, "T", 0, "T", ""}, - {UKEY, "U", 0, "U", ""}, - {VKEY, "V", 0, "V", ""}, - {WKEY, "W", 0, "W", ""}, - {XKEY, "X", 0, "X", ""}, - {YKEY, "Y", 0, "Y", ""}, - {ZKEY, "Z", 0, "Z", ""}, + {EVT_AKEY, "A", 0, "A", ""}, + {EVT_BKEY, "B", 0, "B", ""}, + {EVT_CKEY, "C", 0, "C", ""}, + {EVT_DKEY, "D", 0, "D", ""}, + {EVT_EKEY, "E", 0, "E", ""}, + {EVT_FKEY, "F", 0, "F", ""}, + {EVT_GKEY, "G", 0, "G", ""}, + {EVT_HKEY, "H", 0, "H", ""}, + {EVT_IKEY, "I", 0, "I", ""}, + {EVT_JKEY, "J", 0, "J", ""}, + {EVT_KKEY, "K", 0, "K", ""}, + {EVT_LKEY, "L", 0, "L", ""}, + {EVT_MKEY, "M", 0, "M", ""}, + {EVT_NKEY, "N", 0, "N", ""}, + {EVT_OKEY, "O", 0, "O", ""}, + {EVT_PKEY, "P", 0, "P", ""}, + {EVT_QKEY, "Q", 0, "Q", ""}, + {EVT_RKEY, "R", 0, "R", ""}, + {EVT_SKEY, "S", 0, "S", ""}, + {EVT_TKEY, "T", 0, "T", ""}, + {EVT_UKEY, "U", 0, "U", ""}, + {EVT_VKEY, "V", 0, "V", ""}, + {EVT_WKEY, "W", 0, "W", ""}, + {EVT_XKEY, "X", 0, "X", ""}, + {EVT_YKEY, "Y", 0, "Y", ""}, + {EVT_ZKEY, "Z", 0, "Z", ""}, {0, "", 0, NULL, NULL}, - {ZEROKEY, "ZERO", 0, "0", ""}, - {ONEKEY, "ONE", 0, "1", ""}, - {TWOKEY, "TWO", 0, "2", ""}, - {THREEKEY, "THREE", 0, "3", ""}, - {FOURKEY, "FOUR", 0, "4", ""}, - {FIVEKEY, "FIVE", 0, "5", ""}, - {SIXKEY, "SIX", 0, "6", ""}, - {SEVENKEY, "SEVEN", 0, "7", ""}, - {EIGHTKEY, "EIGHT", 0, "8", ""}, - {NINEKEY, "NINE", 0, "9", ""}, + {EVT_ZEROKEY, "ZERO", 0, "0", ""}, + {EVT_ONEKEY, "ONE", 0, "1", ""}, + {EVT_TWOKEY, "TWO", 0, "2", ""}, + {EVT_THREEKEY, "THREE", 0, "3", ""}, + {EVT_FOURKEY, "FOUR", 0, "4", ""}, + {EVT_FIVEKEY, "FIVE", 0, "5", ""}, + {EVT_SIXKEY, "SIX", 0, "6", ""}, + {EVT_SEVENKEY, "SEVEN", 0, "7", ""}, + {EVT_EIGHTKEY, "EIGHT", 0, "8", ""}, + {EVT_NINEKEY, "NINE", 0, "9", ""}, {0, "", 0, NULL, NULL}, - {LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", "CtrlL"}, - {LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", "AltL"}, - {LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Left Shift", "ShiftL"}, - {RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", "AltR"}, - {RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", "CtrlR"}, - {RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", "ShiftR"}, + {EVT_LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", "CtrlL"}, + {EVT_LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", "AltL"}, + {EVT_LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Left Shift", "ShiftL"}, + {EVT_RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", "AltR"}, + {EVT_RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", "CtrlR"}, + {EVT_RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", "ShiftR"}, {0, "", 0, NULL, NULL}, - {OSKEY, "OSKEY", 0, "OS Key", "Cmd"}, - {APPKEY, "APP", 0, "Application", "App"}, - {GRLESSKEY, "GRLESS", 0, "Grless", ""}, - {ESCKEY, "ESC", 0, "Esc", ""}, - {TABKEY, "TAB", 0, "Tab", ""}, - {RETKEY, "RET", 0, "Return", "Enter"}, - {SPACEKEY, "SPACE", 0, "Spacebar", "Space"}, - {LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""}, - {BACKSPACEKEY, "BACK_SPACE", 0, "Back Space", "BkSpace"}, - {DELKEY, "DEL", 0, "Delete", "Del"}, - {SEMICOLONKEY, "SEMI_COLON", 0, ";", ""}, - {PERIODKEY, "PERIOD", 0, ".", ""}, - {COMMAKEY, "COMMA", 0, ",", ""}, - {QUOTEKEY, "QUOTE", 0, "\"", ""}, - {ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""}, - {MINUSKEY, "MINUS", 0, "-", ""}, - {PLUSKEY, "PLUS", 0, "+", ""}, - {SLASHKEY, "SLASH", 0, "/", ""}, - {BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""}, - {EQUALKEY, "EQUAL", 0, "=", ""}, - {LEFTBRACKETKEY, "LEFT_BRACKET", 0, "[", ""}, - {RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "]", ""}, - {LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", "←"}, - {DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", "↓"}, - {RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", "→"}, - {UPARROWKEY, "UP_ARROW", 0, "Up Arrow", "↑"}, - {PAD2, "NUMPAD_2", 0, "Numpad 2", "Pad2"}, - {PAD4, "NUMPAD_4", 0, "Numpad 4", "Pad4"}, - {PAD6, "NUMPAD_6", 0, "Numpad 6", "Pad6"}, - {PAD8, "NUMPAD_8", 0, "Numpad 8", "Pad8"}, - {PAD1, "NUMPAD_1", 0, "Numpad 1", "Pad1"}, - {PAD3, "NUMPAD_3", 0, "Numpad 3", "Pad3"}, - {PAD5, "NUMPAD_5", 0, "Numpad 5", "Pad5"}, - {PAD7, "NUMPAD_7", 0, "Numpad 7", "Pad7"}, - {PAD9, "NUMPAD_9", 0, "Numpad 9", "Pad9"}, - {PADPERIOD, "NUMPAD_PERIOD", 0, "Numpad .", "Pad."}, - {PADSLASHKEY, "NUMPAD_SLASH", 0, "Numpad /", "Pad/"}, - {PADASTERKEY, "NUMPAD_ASTERIX", 0, "Numpad *", "Pad*"}, - {PAD0, "NUMPAD_0", 0, "Numpad 0", "Pad0"}, - {PADMINUS, "NUMPAD_MINUS", 0, "Numpad -", "Pad-"}, - {PADENTER, "NUMPAD_ENTER", 0, "Numpad Enter", "PadEnter"}, - {PADPLUSKEY, "NUMPAD_PLUS", 0, "Numpad +", "Pad+"}, - {F1KEY, "F1", 0, "F1", ""}, - {F2KEY, "F2", 0, "F2", ""}, - {F3KEY, "F3", 0, "F3", ""}, - {F4KEY, "F4", 0, "F4", ""}, - {F5KEY, "F5", 0, "F5", ""}, - {F6KEY, "F6", 0, "F6", ""}, - {F7KEY, "F7", 0, "F7", ""}, - {F8KEY, "F8", 0, "F8", ""}, - {F9KEY, "F9", 0, "F9", ""}, - {F10KEY, "F10", 0, "F10", ""}, - {F11KEY, "F11", 0, "F11", ""}, - {F12KEY, "F12", 0, "F12", ""}, - {F13KEY, "F13", 0, "F13", ""}, - {F14KEY, "F14", 0, "F14", ""}, - {F15KEY, "F15", 0, "F15", ""}, - {F16KEY, "F16", 0, "F16", ""}, - {F17KEY, "F17", 0, "F17", ""}, - {F18KEY, "F18", 0, "F18", ""}, - {F19KEY, "F19", 0, "F19", ""}, - {F20KEY, "F20", 0, "F20", ""}, - {F21KEY, "F21", 0, "F21", ""}, - {F22KEY, "F22", 0, "F22", ""}, - {F23KEY, "F23", 0, "F23", ""}, - {F24KEY, "F24", 0, "F24", ""}, - {PAUSEKEY, "PAUSE", 0, "Pause", ""}, - {INSERTKEY, "INSERT", 0, "Insert", "Ins"}, - {HOMEKEY, "HOME", 0, "Home", ""}, - {PAGEUPKEY, "PAGE_UP", 0, "Page Up", "PgUp"}, - {PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", "PgDown"}, - {ENDKEY, "END", 0, "End", ""}, + {EVT_OSKEY, "OSKEY", 0, "OS Key", "Cmd"}, + {EVT_APPKEY, "APP", 0, "Application", "App"}, + {EVT_GRLESSKEY, "GRLESS", 0, "Grless", ""}, + {EVT_ESCKEY, "ESC", 0, "Esc", ""}, + {EVT_TABKEY, "TAB", 0, "Tab", ""}, + {EVT_RETKEY, "RET", 0, "Return", "Enter"}, + {EVT_SPACEKEY, "SPACE", 0, "Spacebar", "Space"}, + {EVT_LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""}, + {EVT_BACKSPACEKEY, "BACK_SPACE", 0, "Back Space", "BkSpace"}, + {EVT_DELKEY, "DEL", 0, "Delete", "Del"}, + {EVT_SEMICOLONKEY, "SEMI_COLON", 0, ";", ""}, + {EVT_PERIODKEY, "PERIOD", 0, ".", ""}, + {EVT_COMMAKEY, "COMMA", 0, ",", ""}, + {EVT_QUOTEKEY, "QUOTE", 0, "\"", ""}, + {EVT_ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""}, + {EVT_MINUSKEY, "MINUS", 0, "-", ""}, + {EVT_PLUSKEY, "PLUS", 0, "+", ""}, + {EVT_SLASHKEY, "SLASH", 0, "/", ""}, + {EVT_BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""}, + {EVT_EQUALKEY, "EQUAL", 0, "=", ""}, + {EVT_LEFTBRACKETKEY, "LEFT_BRACKET", 0, "[", ""}, + {EVT_RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "]", ""}, + {EVT_LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", "←"}, + {EVT_DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", "↓"}, + {EVT_RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", "→"}, + {EVT_UPARROWKEY, "UP_ARROW", 0, "Up Arrow", "↑"}, + {EVT_PAD2, "NUMPAD_2", 0, "Numpad 2", "Pad2"}, + {EVT_PAD4, "NUMPAD_4", 0, "Numpad 4", "Pad4"}, + {EVT_PAD6, "NUMPAD_6", 0, "Numpad 6", "Pad6"}, + {EVT_PAD8, "NUMPAD_8", 0, "Numpad 8", "Pad8"}, + {EVT_PAD1, "NUMPAD_1", 0, "Numpad 1", "Pad1"}, + {EVT_PAD3, "NUMPAD_3", 0, "Numpad 3", "Pad3"}, + {EVT_PAD5, "NUMPAD_5", 0, "Numpad 5", "Pad5"}, + {EVT_PAD7, "NUMPAD_7", 0, "Numpad 7", "Pad7"}, + {EVT_PAD9, "NUMPAD_9", 0, "Numpad 9", "Pad9"}, + {EVT_PADPERIOD, "NUMPAD_PERIOD", 0, "Numpad .", "Pad."}, + {EVT_PADSLASHKEY, "NUMPAD_SLASH", 0, "Numpad /", "Pad/"}, + {EVT_PADASTERKEY, "NUMPAD_ASTERIX", 0, "Numpad *", "Pad*"}, + {EVT_PAD0, "NUMPAD_0", 0, "Numpad 0", "Pad0"}, + {EVT_PADMINUS, "NUMPAD_MINUS", 0, "Numpad -", "Pad-"}, + {EVT_PADENTER, "NUMPAD_ENTER", 0, "Numpad Enter", "PadEnter"}, + {EVT_PADPLUSKEY, "NUMPAD_PLUS", 0, "Numpad +", "Pad+"}, + {EVT_F1KEY, "F1", 0, "F1", ""}, + {EVT_F2KEY, "F2", 0, "F2", ""}, + {EVT_F3KEY, "F3", 0, "F3", ""}, + {EVT_F4KEY, "F4", 0, "F4", ""}, + {EVT_F5KEY, "F5", 0, "F5", ""}, + {EVT_F6KEY, "F6", 0, "F6", ""}, + {EVT_F7KEY, "F7", 0, "F7", ""}, + {EVT_F8KEY, "F8", 0, "F8", ""}, + {EVT_F9KEY, "F9", 0, "F9", ""}, + {EVT_F10KEY, "F10", 0, "F10", ""}, + {EVT_F11KEY, "F11", 0, "F11", ""}, + {EVT_F12KEY, "F12", 0, "F12", ""}, + {EVT_F13KEY, "F13", 0, "F13", ""}, + {EVT_F14KEY, "F14", 0, "F14", ""}, + {EVT_F15KEY, "F15", 0, "F15", ""}, + {EVT_F16KEY, "F16", 0, "F16", ""}, + {EVT_F17KEY, "F17", 0, "F17", ""}, + {EVT_F18KEY, "F18", 0, "F18", ""}, + {EVT_F19KEY, "F19", 0, "F19", ""}, + {EVT_F20KEY, "F20", 0, "F20", ""}, + {EVT_F21KEY, "F21", 0, "F21", ""}, + {EVT_F22KEY, "F22", 0, "F22", ""}, + {EVT_F23KEY, "F23", 0, "F23", ""}, + {EVT_F24KEY, "F24", 0, "F24", ""}, + {EVT_PAUSEKEY, "PAUSE", 0, "Pause", ""}, + {EVT_INSERTKEY, "INSERT", 0, "Insert", "Ins"}, + {EVT_HOMEKEY, "HOME", 0, "Home", ""}, + {EVT_PAGEUPKEY, "PAGE_UP", 0, "Page Up", "PgUp"}, + {EVT_PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", "PgDown"}, + {EVT_ENDKEY, "END", 0, "End", ""}, {0, "", 0, NULL, NULL}, - {MEDIAPLAY, "MEDIA_PLAY", 0, "Media Play/Pause", ">/||"}, - {MEDIASTOP, "MEDIA_STOP", 0, "Media Stop", "Stop"}, - {MEDIAFIRST, "MEDIA_FIRST", 0, "Media First", "|<<"}, - {MEDIALAST, "MEDIA_LAST", 0, "Media Last", ">>|"}, + {EVT_MEDIAPLAY, "MEDIA_PLAY", 0, "Media Play/Pause", ">/||"}, + {EVT_MEDIASTOP, "MEDIA_STOP", 0, "Media Stop", "Stop"}, + {EVT_MEDIAFIRST, "MEDIA_FIRST", 0, "Media First", "|<<"}, + {EVT_MEDIALAST, "MEDIA_LAST", 0, "Media Last", ">>|"}, {0, "", 0, NULL, NULL}, {KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", "TxtIn"}, {0, "", 0, NULL, NULL}, @@ -883,7 +883,7 @@ static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value) if (value != map_type) { switch (value) { case KMI_TYPE_KEYBOARD: - kmi->type = AKEY; + kmi->type = EVT_AKEY; kmi->val = KM_PRESS; break; case KMI_TYPE_TWEAK: @@ -919,10 +919,10 @@ static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value) /* XXX, this should really be managed in an _itemf function, * giving a list of valid enums, then silently changing them when they are set is not * a good precedent, don't do this unless you have a good reason! */ - if (value == ESCKEY) { + if (value == EVT_ESCKEY) { /* pass */ } - else if (value >= AKEY) { + else if (value >= EVT_AKEY) { kmi->keymodifier = value; } else { diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c index f2cd847fe75..066aae9071c 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c @@ -675,21 +675,24 @@ wmKeyMap *wm_gizmogroup_tweak_modal_keymap(wmKeyConfig *kc) keymap = WM_modalkeymap_add(kc, name, modal_items); /* items for modal map */ - WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CANCEL); + WM_modalkeymap_add_item(keymap, EVT_ESCKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CANCEL); - WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CONFIRM); - WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CONFIRM); - - WM_modalkeymap_add_item(keymap, RIGHTSHIFTKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_PRECISION_ON); - WM_modalkeymap_add_item(keymap, RIGHTSHIFTKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_PRECISION_OFF); - WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_PRECISION_ON); - WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_PRECISION_OFF); - - WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_SNAP_ON); - WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_SNAP_OFF); - WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_SNAP_ON); - WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_SNAP_OFF); + WM_modalkeymap_add_item(keymap, EVT_RETKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CONFIRM); + WM_modalkeymap_add_item(keymap, EVT_PADENTER, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CONFIRM); + + WM_modalkeymap_add_item( + keymap, EVT_RIGHTSHIFTKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_PRECISION_ON); + WM_modalkeymap_add_item( + keymap, EVT_RIGHTSHIFTKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_PRECISION_OFF); + WM_modalkeymap_add_item(keymap, EVT_LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_PRECISION_ON); + WM_modalkeymap_add_item( + keymap, EVT_LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_PRECISION_OFF); + + WM_modalkeymap_add_item(keymap, EVT_RIGHTCTRLKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_SNAP_ON); + WM_modalkeymap_add_item(keymap, EVT_RIGHTCTRLKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_SNAP_OFF); + WM_modalkeymap_add_item(keymap, EVT_LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_SNAP_ON); + WM_modalkeymap_add_item(keymap, EVT_LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_SNAP_OFF); WM_modalkeymap_assign(keymap, "GIZMOGROUP_OT_gizmo_tweak"); diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index f69bc822f44..06a6a9d039a 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -311,19 +311,19 @@ bool wm_cursor_arrow_move(wmWindow *win, const wmEvent *event) /* Must move at least this much to avoid rounding in WM_cursor_warp. */ float fac = GHOST_GetNativePixelSize(win->ghostwin); - if (event->type == UPARROWKEY) { + if (event->type == EVT_UPARROWKEY) { wm_cursor_warp_relative(win, 0, fac); return 1; } - else if (event->type == DOWNARROWKEY) { + else if (event->type == EVT_DOWNARROWKEY) { wm_cursor_warp_relative(win, 0, -fac); return 1; } - else if (event->type == LEFTARROWKEY) { + else if (event->type == EVT_LEFTARROWKEY) { wm_cursor_warp_relative(win, -fac, 0); return 1; } - else if (event->type == RIGHTARROWKEY) { + else if (event->type == EVT_RIGHTARROWKEY) { wm_cursor_warp_relative(win, fac, 0); return 1; } diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c index f1a03efa49b..eaddbb25034 100644 --- a/source/blender/windowmanager/intern/wm_event_query.c +++ b/source/blender/windowmanager/intern/wm_event_query.c @@ -420,7 +420,7 @@ bool WM_event_is_tablet(const struct wmEvent *event) /* most os using ctrl/oskey + space to switch ime, avoid added space */ bool WM_event_is_ime_switch(const struct wmEvent *event) { - return event->val == KM_PRESS && event->type == SPACEKEY && + return event->val == KM_PRESS && event->type == EVT_SPACEKEY && (event->ctrl || event->oskey || event->shift || event->alt); } #endif diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index c7556ec7516..c14ae57d4a3 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1824,25 +1824,25 @@ static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi) * Account for rare case of when these keys are used as the 'type' not as modifiers. */ if (kmi->shift != KM_ANY) { if ((winevent->shift != kmi->shift) && !(winevent->shift & kmi->shift) && - !ELEM(winevent->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) { + !ELEM(winevent->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) { return false; } } if (kmi->ctrl != KM_ANY) { if (winevent->ctrl != kmi->ctrl && !(winevent->ctrl & kmi->ctrl) && - !ELEM(winevent->type, LEFTCTRLKEY, RIGHTCTRLKEY)) { + !ELEM(winevent->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) { return false; } } if (kmi->alt != KM_ANY) { if (winevent->alt != kmi->alt && !(winevent->alt & kmi->alt) && - !ELEM(winevent->type, LEFTALTKEY, RIGHTALTKEY)) { + !ELEM(winevent->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY)) { return false; } } if (kmi->oskey != KM_ANY) { if (winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey) && - (winevent->type != OSKEY)) { + (winevent->type != EVT_OSKEY)) { return false; } } @@ -3059,7 +3059,7 @@ static void wm_event_drag_and_drop_test(wmWindowManager *wm, wmWindow *win, wmEv if (event->type == MOUSEMOVE || ISKEYMODIFIER(event->type)) { screen->do_draw_drag = true; } - else if (event->type == ESCKEY) { + else if (event->type == EVT_ESCKEY) { WM_drag_free_list(&wm->drags); screen->do_draw_drag = true; @@ -3910,139 +3910,139 @@ void WM_event_add_mousemove(wmWindow *win) static int convert_key(GHOST_TKey key) { if (key >= GHOST_kKeyA && key <= GHOST_kKeyZ) { - return (AKEY + ((int)key - GHOST_kKeyA)); + return (EVT_AKEY + ((int)key - GHOST_kKeyA)); } else if (key >= GHOST_kKey0 && key <= GHOST_kKey9) { - return (ZEROKEY + ((int)key - GHOST_kKey0)); + return (EVT_ZEROKEY + ((int)key - GHOST_kKey0)); } else if (key >= GHOST_kKeyNumpad0 && key <= GHOST_kKeyNumpad9) { - return (PAD0 + ((int)key - GHOST_kKeyNumpad0)); + return (EVT_PAD0 + ((int)key - GHOST_kKeyNumpad0)); } else if (key >= GHOST_kKeyF1 && key <= GHOST_kKeyF24) { - return (F1KEY + ((int)key - GHOST_kKeyF1)); + return (EVT_F1KEY + ((int)key - GHOST_kKeyF1)); } else { switch (key) { case GHOST_kKeyBackSpace: - return BACKSPACEKEY; + return EVT_BACKSPACEKEY; case GHOST_kKeyTab: - return TABKEY; + return EVT_TABKEY; case GHOST_kKeyLinefeed: - return LINEFEEDKEY; + return EVT_LINEFEEDKEY; case GHOST_kKeyClear: return 0; case GHOST_kKeyEnter: - return RETKEY; + return EVT_RETKEY; case GHOST_kKeyEsc: - return ESCKEY; + return EVT_ESCKEY; case GHOST_kKeySpace: - return SPACEKEY; + return EVT_SPACEKEY; case GHOST_kKeyQuote: - return QUOTEKEY; + return EVT_QUOTEKEY; case GHOST_kKeyComma: - return COMMAKEY; + return EVT_COMMAKEY; case GHOST_kKeyMinus: - return MINUSKEY; + return EVT_MINUSKEY; case GHOST_kKeyPlus: - return PLUSKEY; + return EVT_PLUSKEY; case GHOST_kKeyPeriod: - return PERIODKEY; + return EVT_PERIODKEY; case GHOST_kKeySlash: - return SLASHKEY; + return EVT_SLASHKEY; case GHOST_kKeySemicolon: - return SEMICOLONKEY; + return EVT_SEMICOLONKEY; case GHOST_kKeyEqual: - return EQUALKEY; + return EVT_EQUALKEY; case GHOST_kKeyLeftBracket: - return LEFTBRACKETKEY; + return EVT_LEFTBRACKETKEY; case GHOST_kKeyRightBracket: - return RIGHTBRACKETKEY; + return EVT_RIGHTBRACKETKEY; case GHOST_kKeyBackslash: - return BACKSLASHKEY; + return EVT_BACKSLASHKEY; case GHOST_kKeyAccentGrave: - return ACCENTGRAVEKEY; + return EVT_ACCENTGRAVEKEY; case GHOST_kKeyLeftShift: - return LEFTSHIFTKEY; + return EVT_LEFTSHIFTKEY; case GHOST_kKeyRightShift: - return RIGHTSHIFTKEY; + return EVT_RIGHTSHIFTKEY; case GHOST_kKeyLeftControl: - return LEFTCTRLKEY; + return EVT_LEFTCTRLKEY; case GHOST_kKeyRightControl: - return RIGHTCTRLKEY; + return EVT_RIGHTCTRLKEY; case GHOST_kKeyOS: - return OSKEY; + return EVT_OSKEY; case GHOST_kKeyLeftAlt: - return LEFTALTKEY; + return EVT_LEFTALTKEY; case GHOST_kKeyRightAlt: - return RIGHTALTKEY; + return EVT_RIGHTALTKEY; case GHOST_kKeyApp: - return APPKEY; + return EVT_APPKEY; case GHOST_kKeyCapsLock: - return CAPSLOCKKEY; + return EVT_CAPSLOCKKEY; case GHOST_kKeyNumLock: return 0; case GHOST_kKeyScrollLock: return 0; case GHOST_kKeyLeftArrow: - return LEFTARROWKEY; + return EVT_LEFTARROWKEY; case GHOST_kKeyRightArrow: - return RIGHTARROWKEY; + return EVT_RIGHTARROWKEY; case GHOST_kKeyUpArrow: - return UPARROWKEY; + return EVT_UPARROWKEY; case GHOST_kKeyDownArrow: - return DOWNARROWKEY; + return EVT_DOWNARROWKEY; case GHOST_kKeyPrintScreen: return 0; case GHOST_kKeyPause: - return PAUSEKEY; + return EVT_PAUSEKEY; case GHOST_kKeyInsert: - return INSERTKEY; + return EVT_INSERTKEY; case GHOST_kKeyDelete: - return DELKEY; + return EVT_DELKEY; case GHOST_kKeyHome: - return HOMEKEY; + return EVT_HOMEKEY; case GHOST_kKeyEnd: - return ENDKEY; + return EVT_ENDKEY; case GHOST_kKeyUpPage: - return PAGEUPKEY; + return EVT_PAGEUPKEY; case GHOST_kKeyDownPage: - return PAGEDOWNKEY; + return EVT_PAGEDOWNKEY; case GHOST_kKeyNumpadPeriod: - return PADPERIOD; + return EVT_PADPERIOD; case GHOST_kKeyNumpadEnter: - return PADENTER; + return EVT_PADENTER; case GHOST_kKeyNumpadPlus: - return PADPLUSKEY; + return EVT_PADPLUSKEY; case GHOST_kKeyNumpadMinus: - return PADMINUS; + return EVT_PADMINUS; case GHOST_kKeyNumpadAsterisk: - return PADASTERKEY; + return EVT_PADASTERKEY; case GHOST_kKeyNumpadSlash: - return PADSLASHKEY; + return EVT_PADSLASHKEY; case GHOST_kKeyGrLess: - return GRLESSKEY; + return EVT_GRLESSKEY; case GHOST_kKeyMediaPlay: - return MEDIAPLAY; + return EVT_MEDIAPLAY; case GHOST_kKeyMediaStop: - return MEDIASTOP; + return EVT_MEDIASTOP; case GHOST_kKeyMediaFirst: - return MEDIAFIRST; + return EVT_MEDIAFIRST; case GHOST_kKeyMediaLast: - return MEDIALAST; + return EVT_MEDIALAST; default: - return UNKNOWNKEY; /* GHOST_kKeyUnknown */ + return EVT_UNKNOWNKEY; /* GHOST_kKeyUnknown */ } } } @@ -4095,44 +4095,44 @@ static void wm_eventemulation(wmEvent *event, bool test_only) /* numpad emulation */ if (U.flag & USER_NONUMPAD) { switch (event->type) { - case ZEROKEY: - event->type = PAD0; + case EVT_ZEROKEY: + event->type = EVT_PAD0; break; - case ONEKEY: - event->type = PAD1; + case EVT_ONEKEY: + event->type = EVT_PAD1; break; - case TWOKEY: - event->type = PAD2; + case EVT_TWOKEY: + event->type = EVT_PAD2; break; - case THREEKEY: - event->type = PAD3; + case EVT_THREEKEY: + event->type = EVT_PAD3; break; - case FOURKEY: - event->type = PAD4; + case EVT_FOURKEY: + event->type = EVT_PAD4; break; - case FIVEKEY: - event->type = PAD5; + case EVT_FIVEKEY: + event->type = EVT_PAD5; break; - case SIXKEY: - event->type = PAD6; + case EVT_SIXKEY: + event->type = EVT_PAD6; break; - case SEVENKEY: - event->type = PAD7; + case EVT_SEVENKEY: + event->type = EVT_PAD7; break; - case EIGHTKEY: - event->type = PAD8; + case EVT_EIGHTKEY: + event->type = EVT_PAD8; break; - case NINEKEY: - event->type = PAD9; + case EVT_NINEKEY: + event->type = EVT_PAD9; break; - case MINUSKEY: - event->type = PADMINUS; + case EVT_MINUSKEY: + event->type = EVT_PADMINUS; break; - case EQUALKEY: - event->type = PADPLUSKEY; + case EVT_EQUALKEY: + event->type = EVT_PADPLUSKEY; break; - case BACKSLASHKEY: - event->type = PADSLASHKEY; + case EVT_BACKSLASHKEY: + event->type = EVT_PADSLASHKEY; break; } } @@ -4497,8 +4497,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void /* assigning both first and second is strange - campbell */ switch (event.type) { - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: if (event.val == KM_PRESS) { if (evt->ctrl || evt->alt || evt->oskey) { keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND); @@ -4509,8 +4509,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void } event.shift = evt->shift = keymodifier; break; - case LEFTCTRLKEY: - case RIGHTCTRLKEY: + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: if (event.val == KM_PRESS) { if (evt->shift || evt->alt || evt->oskey) { keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND); @@ -4521,8 +4521,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void } event.ctrl = evt->ctrl = keymodifier; break; - case LEFTALTKEY: - case RIGHTALTKEY: + case EVT_LEFTALTKEY: + case EVT_RIGHTALTKEY: if (event.val == KM_PRESS) { if (evt->ctrl || evt->shift || evt->oskey) { keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND); @@ -4533,7 +4533,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void } event.alt = evt->alt = keymodifier; break; - case OSKEY: + case EVT_OSKEY: if (event.val == KM_PRESS) { if (evt->ctrl || evt->alt || evt->shift) { keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND); @@ -4572,13 +4572,13 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void * (to compose complex latin characters e.g.), it's not really clear why. * Since it's impossible to map a key modifier to an unknown key, * it shouldn't harm to clear it. */ - if (event.keymodifier == UNKNOWNKEY) { + if (event.keymodifier == EVT_UNKNOWNKEY) { evt->keymodifier = event.keymodifier = 0; } /* if test_break set, it catches this. Do not set with modifier presses. * XXX Keep global for now? */ - if ((event.type == ESCKEY && event.val == KM_PRESS) && + if ((event.type == EVT_ESCKEY && event.val == KM_PRESS) && /* check other modifiers because ms-windows uses these to bring up the task manager */ (event.shift == 0 && event.ctrl == 0 && event.alt == 0)) { G.is_break = true; diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c index 82bc591e2a4..341bd4a16f7 100644 --- a/source/blender/windowmanager/intern/wm_gesture_ops.c +++ b/source/blender/windowmanager/intern/wm_gesture_ops.c @@ -687,7 +687,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } break; - case ESCKEY: + case EVT_ESCKEY: gesture_modal_end(C, op); return OPERATOR_CANCELLED; } diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 0aa146bbc83..a8c52aa1314 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1096,29 +1096,29 @@ const char *WM_key_event_string(const short type, const bool compact) ; switch (type) { - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: { + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: { if (platform == MACOS) { single_glyph = "\xe2\x87\xa7"; } return key_event_glyph_or_text( font_id, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Shift"), single_glyph); } - case LEFTCTRLKEY: - case RIGHTCTRLKEY: + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: if (platform == MACOS) { return key_event_glyph_or_text(font_id, "^", "\xe2\x8c\x83"); } return IFACE_("Ctrl"); - case LEFTALTKEY: - case RIGHTALTKEY: { + case EVT_LEFTALTKEY: + case EVT_RIGHTALTKEY: { if (platform == MACOS) { /* Option symbol on Mac keyboard. */ single_glyph = "\xe2\x8c\xa5"; } return key_event_glyph_or_text(font_id, IFACE_("Alt"), single_glyph); } - case OSKEY: { + case EVT_OSKEY: { if (platform == MACOS) { return key_event_glyph_or_text(font_id, IFACE_("Cmd"), "\xe2\x8c\x98"); } @@ -1127,26 +1127,26 @@ const char *WM_key_event_string(const short type, const bool compact) } return IFACE_("OS"); } break; - case TABKEY: + case EVT_TABKEY: return key_event_glyph_or_text(font_id, IFACE_("Tab"), "\xe2\xad\xbe"); - case BACKSPACEKEY: + case EVT_BACKSPACEKEY: return key_event_glyph_or_text(font_id, IFACE_("Bksp"), "\xe2\x8c\xab"); - case ESCKEY: + case EVT_ESCKEY: if (platform == MACOS) { single_glyph = "\xe2\x8e\x8b"; } return key_event_glyph_or_text(font_id, IFACE_("Esc"), single_glyph); - case RETKEY: + case EVT_RETKEY: return key_event_glyph_or_text(font_id, IFACE_("Enter"), "\xe2\x86\xb5"); - case SPACEKEY: + case EVT_SPACEKEY: return key_event_glyph_or_text(font_id, IFACE_("Space"), "\xe2\x90\xa3"); - case LEFTARROWKEY: + case EVT_LEFTARROWKEY: return key_event_glyph_or_text(font_id, IFACE_("Left"), "\xe2\x86\x90"); - case UPARROWKEY: + case EVT_UPARROWKEY: return key_event_glyph_or_text(font_id, IFACE_("Up"), "\xe2\x86\x91"); - case RIGHTARROWKEY: + case EVT_RIGHTARROWKEY: return key_event_glyph_or_text(font_id, IFACE_("Right"), "\xe2\x86\x92"); - case DOWNARROWKEY: + case EVT_DOWNARROWKEY: return key_event_glyph_or_text(font_id, IFACE_("Down"), "\xe2\x86\x93"); } } @@ -1198,22 +1198,22 @@ int WM_keymap_item_raw_to_string(const short shift, else { if (shift) { ADD_SEP; - p += BLI_strcpy_rlen(p, WM_key_event_string(LEFTSHIFTKEY, true)); + p += BLI_strcpy_rlen(p, WM_key_event_string(EVT_LEFTSHIFTKEY, true)); } if (ctrl) { ADD_SEP; - p += BLI_strcpy_rlen(p, WM_key_event_string(LEFTCTRLKEY, true)); + p += BLI_strcpy_rlen(p, WM_key_event_string(EVT_LEFTCTRLKEY, true)); } if (alt) { ADD_SEP; - p += BLI_strcpy_rlen(p, WM_key_event_string(LEFTALTKEY, true)); + p += BLI_strcpy_rlen(p, WM_key_event_string(EVT_LEFTALTKEY, true)); } if (oskey) { ADD_SEP; - p += BLI_strcpy_rlen(p, WM_key_event_string(OSKEY, true)); + p += BLI_strcpy_rlen(p, WM_key_event_string(EVT_OSKEY, true)); } } diff --git a/source/blender/windowmanager/intern/wm_operator_utils.c b/source/blender/windowmanager/intern/wm_operator_utils.c index d0abdec1376..c3dab133e44 100644 --- a/source/blender/windowmanager/intern/wm_operator_utils.c +++ b/source/blender/windowmanager/intern/wm_operator_utils.c @@ -252,10 +252,10 @@ static int op_generic_value_modal(bContext *C, wmOperator *op, const wmEvent *ev switch (event->type) { case MOUSEMOVE: - case LEFTCTRLKEY: - case RIGHTCTRLKEY: - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: { + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: { float value_final; if (cd->is_active && interactive_value_update(&cd->inter, event, &value_final)) { wmWindowManager *wm = CTX_wm_manager(C); @@ -279,8 +279,8 @@ static int op_generic_value_modal(bContext *C, wmOperator *op, const wmEvent *ev } break; } - case RETKEY: - case PADENTER: + case EVT_RETKEY: + case EVT_PADENTER: case LEFTMOUSE: { if (cd->wait_for_input) { if (event->val == KM_PRESS) { @@ -304,7 +304,7 @@ static int op_generic_value_modal(bContext *C, wmOperator *op, const wmEvent *ev } break; } - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: { if (event->val == KM_PRESS) { if (cd->is_active == true) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1d6ae10c396..b67d05d8b7a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1749,7 +1749,7 @@ static int wm_search_menu_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) static int wm_search_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { /* Exception for launching via spacebar */ - if (event->type == SPACEKEY) { + if (event->type == EVT_SPACEKEY) { bool ok = true; ScrArea *sa = CTX_wm_area(C); if (sa) { @@ -2815,7 +2815,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even else { handled = false; switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: /* canceled; restore original value */ radial_control_set_value(rc, rc->initial_value); @@ -2823,8 +2823,8 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even break; case LEFTMOUSE: - case PADENTER: - case RETKEY: + case EVT_PADENTER: + case EVT_RETKEY: /* done; value already set */ RNA_property_update(C, &rc->ptr, rc->prop); ret = OPERATOR_FINISHED; @@ -2930,8 +2930,8 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even } break; - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: { + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: { if (event->val == KM_PRESS) { rc->slow_mouse[0] = event->x; rc->slow_mouse[1] = event->y; diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index 046783b157b..f16056cc91e 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -96,144 +96,140 @@ enum { /* Standard keyboard. * From 0x0020 to 0x00ff, and 0x012c to 0x0143 for function keys! */ - ZEROKEY = 0x0030, /* '0' (48). */ - ONEKEY = 0x0031, /* '1' (49). */ - TWOKEY = 0x0032, /* '2' (50). */ - THREEKEY = 0x0033, /* '3' (51). */ - FOURKEY = 0x0034, /* '4' (52). */ - FIVEKEY = 0x0035, /* '5' (53). */ - SIXKEY = 0x0036, /* '6' (54). */ - SEVENKEY = 0x0037, /* '7' (55). */ - EIGHTKEY = 0x0038, /* '8' (56). */ - NINEKEY = 0x0039, /* '9' (57). */ - - AKEY = 0x0061, /* 'a' (97). */ - BKEY = 0x0062, /* 'b' (98). */ - CKEY = 0x0063, /* 'c' (99). */ - DKEY = 0x0064, /* 'd' (100). */ - EKEY = 0x0065, /* 'e' (101). */ - FKEY = 0x0066, /* 'f' (102). */ - GKEY = 0x0067, /* 'g' (103). */ -#ifndef WIN32 - HKEY = 0x0068, /* 'h' (104). */ -#else -# define HKEY 0x0068 -#endif - IKEY = 0x0069, /* 'i' (105). */ - JKEY = 0x006a, /* 'j' (106). */ - KKEY = 0x006b, /* 'k' (107). */ - LKEY = 0x006c, /* 'l' (108). */ - MKEY = 0x006d, /* 'm' (109). */ - NKEY = 0x006e, /* 'n' (110). */ - OKEY = 0x006f, /* 'o' (111). */ - PKEY = 0x0070, /* 'p' (112). */ - QKEY = 0x0071, /* 'q' (113). */ - RKEY = 0x0072, /* 'r' (114). */ - SKEY = 0x0073, /* 's' (115). */ - TKEY = 0x0074, /* 't' (116). */ - UKEY = 0x0075, /* 'u' (117). */ - VKEY = 0x0076, /* 'v' (118). */ - WKEY = 0x0077, /* 'w' (119). */ - XKEY = 0x0078, /* 'x' (120). */ - YKEY = 0x0079, /* 'y' (121). */ - ZKEY = 0x007a, /* 'z' (122). */ - - LEFTARROWKEY = 0x0089, /* 137 */ - DOWNARROWKEY = 0x008a, /* 138 */ - RIGHTARROWKEY = 0x008b, /* 139 */ - UPARROWKEY = 0x008c, /* 140 */ - - PAD0 = 0x0096, /* 150 */ - PAD1 = 0x0097, /* 151 */ - PAD2 = 0x0098, /* 152 */ - PAD3 = 0x0099, /* 153 */ - PAD4 = 0x009a, /* 154 */ - PAD5 = 0x009b, /* 155 */ - PAD6 = 0x009c, /* 156 */ - PAD7 = 0x009d, /* 157 */ - PAD8 = 0x009e, /* 158 */ - PAD9 = 0x009f, /* 159 */ + EVT_ZEROKEY = 0x0030, /* '0' (48). */ + EVT_ONEKEY = 0x0031, /* '1' (49). */ + EVT_TWOKEY = 0x0032, /* '2' (50). */ + EVT_THREEKEY = 0x0033, /* '3' (51). */ + EVT_FOURKEY = 0x0034, /* '4' (52). */ + EVT_FIVEKEY = 0x0035, /* '5' (53). */ + EVT_SIXKEY = 0x0036, /* '6' (54). */ + EVT_SEVENKEY = 0x0037, /* '7' (55). */ + EVT_EIGHTKEY = 0x0038, /* '8' (56). */ + EVT_NINEKEY = 0x0039, /* '9' (57). */ + + EVT_AKEY = 0x0061, /* 'a' (97). */ + EVT_BKEY = 0x0062, /* 'b' (98). */ + EVT_CKEY = 0x0063, /* 'c' (99). */ + EVT_DKEY = 0x0064, /* 'd' (100). */ + EVT_EKEY = 0x0065, /* 'e' (101). */ + EVT_FKEY = 0x0066, /* 'f' (102). */ + EVT_GKEY = 0x0067, /* 'g' (103). */ + EVT_HKEY = 0x0068, /* 'h' (104). */ + EVT_IKEY = 0x0069, /* 'i' (105). */ + EVT_JKEY = 0x006a, /* 'j' (106). */ + EVT_KKEY = 0x006b, /* 'k' (107). */ + EVT_LKEY = 0x006c, /* 'l' (108). */ + EVT_MKEY = 0x006d, /* 'm' (109). */ + EVT_NKEY = 0x006e, /* 'n' (110). */ + EVT_OKEY = 0x006f, /* 'o' (111). */ + EVT_PKEY = 0x0070, /* 'p' (112). */ + EVT_QKEY = 0x0071, /* 'q' (113). */ + EVT_RKEY = 0x0072, /* 'r' (114). */ + EVT_SKEY = 0x0073, /* 's' (115). */ + EVT_TKEY = 0x0074, /* 't' (116). */ + EVT_UKEY = 0x0075, /* 'u' (117). */ + EVT_VKEY = 0x0076, /* 'v' (118). */ + EVT_WKEY = 0x0077, /* 'w' (119). */ + EVT_XKEY = 0x0078, /* 'x' (120). */ + EVT_YKEY = 0x0079, /* 'y' (121). */ + EVT_ZKEY = 0x007a, /* 'z' (122). */ + + EVT_LEFTARROWKEY = 0x0089, /* 137 */ + EVT_DOWNARROWKEY = 0x008a, /* 138 */ + EVT_RIGHTARROWKEY = 0x008b, /* 139 */ + EVT_UPARROWKEY = 0x008c, /* 140 */ + + EVT_PAD0 = 0x0096, /* 150 */ + EVT_PAD1 = 0x0097, /* 151 */ + EVT_PAD2 = 0x0098, /* 152 */ + EVT_PAD3 = 0x0099, /* 153 */ + EVT_PAD4 = 0x009a, /* 154 */ + EVT_PAD5 = 0x009b, /* 155 */ + EVT_PAD6 = 0x009c, /* 156 */ + EVT_PAD7 = 0x009d, /* 157 */ + EVT_PAD8 = 0x009e, /* 158 */ + EVT_PAD9 = 0x009f, /* 159 */ /* Key-pad keys. */ - PADASTERKEY = 0x00a0, /* 160 */ - PADSLASHKEY = 0x00a1, /* 161 */ - PADMINUS = 0x00a2, /* 162 */ - PADENTER = 0x00a3, /* 163 */ - PADPLUSKEY = 0x00a4, /* 164 */ - - PAUSEKEY = 0x00a5, /* 165 */ - INSERTKEY = 0x00a6, /* 166 */ - HOMEKEY = 0x00a7, /* 167 */ - PAGEUPKEY = 0x00a8, /* 168 */ - PAGEDOWNKEY = 0x00a9, /* 169 */ - ENDKEY = 0x00aa, /* 170 */ + EVT_PADASTERKEY = 0x00a0, /* 160 */ + EVT_PADSLASHKEY = 0x00a1, /* 161 */ + EVT_PADMINUS = 0x00a2, /* 162 */ + EVT_PADENTER = 0x00a3, /* 163 */ + EVT_PADPLUSKEY = 0x00a4, /* 164 */ + + EVT_PAUSEKEY = 0x00a5, /* 165 */ + EVT_INSERTKEY = 0x00a6, /* 166 */ + EVT_HOMEKEY = 0x00a7, /* 167 */ + EVT_PAGEUPKEY = 0x00a8, /* 168 */ + EVT_PAGEDOWNKEY = 0x00a9, /* 169 */ + EVT_ENDKEY = 0x00aa, /* 170 */ /* Note that 'PADPERIOD' is defined out-of-order. */ - UNKNOWNKEY = 0x00ab, /* 171 */ - OSKEY = 0x00ac, /* 172 */ - GRLESSKEY = 0x00ad, /* 173 */ + EVT_UNKNOWNKEY = 0x00ab, /* 171 */ + EVT_OSKEY = 0x00ac, /* 172 */ + EVT_GRLESSKEY = 0x00ad, /* 173 */ /* Media keys. */ - MEDIAPLAY = 0x00ae, /* 174 */ - MEDIASTOP = 0x00af, /* 175 */ - MEDIAFIRST = 0x00b0, /* 176 */ - MEDIALAST = 0x00b1, /* 177 */ + EVT_MEDIAPLAY = 0x00ae, /* 174 */ + EVT_MEDIASTOP = 0x00af, /* 175 */ + EVT_MEDIAFIRST = 0x00b0, /* 176 */ + EVT_MEDIALAST = 0x00b1, /* 177 */ /* Menu/App key. */ - APPKEY = 0x00b2, /* 178 */ + EVT_APPKEY = 0x00b2, /* 178 */ - PADPERIOD = 0x00c7, /* 199 */ + EVT_PADPERIOD = 0x00c7, /* 199 */ - CAPSLOCKKEY = 0x00d3, /* 211 */ + EVT_CAPSLOCKKEY = 0x00d3, /* 211 */ /* Modifier keys. */ - LEFTCTRLKEY = 0x00d4, /* 212 */ - LEFTALTKEY = 0x00d5, /* 213 */ - RIGHTALTKEY = 0x00d6, /* 214 */ - RIGHTCTRLKEY = 0x00d7, /* 215 */ - RIGHTSHIFTKEY = 0x00d8, /* 216 */ - LEFTSHIFTKEY = 0x00d9, /* 217 */ + EVT_LEFTCTRLKEY = 0x00d4, /* 212 */ + EVT_LEFTALTKEY = 0x00d5, /* 213 */ + EVT_RIGHTALTKEY = 0x00d6, /* 214 */ + EVT_RIGHTCTRLKEY = 0x00d7, /* 215 */ + EVT_RIGHTSHIFTKEY = 0x00d8, /* 216 */ + EVT_LEFTSHIFTKEY = 0x00d9, /* 217 */ /* Special characters. */ - ESCKEY = 0x00da, /* 218 */ - TABKEY = 0x00db, /* 219 */ - RETKEY = 0x00dc, /* 220 */ - SPACEKEY = 0x00dd, /* 221 */ - LINEFEEDKEY = 0x00de, /* 222 */ - BACKSPACEKEY = 0x00df, /* 223 */ - DELKEY = 0x00e0, /* 224 */ - SEMICOLONKEY = 0x00e1, /* 225 */ - PERIODKEY = 0x00e2, /* 226 */ - COMMAKEY = 0x00e3, /* 227 */ - QUOTEKEY = 0x00e4, /* 228 */ - ACCENTGRAVEKEY = 0x00e5, /* 229 */ - MINUSKEY = 0x00e6, /* 230 */ - PLUSKEY = 0x00e7, /* 231 */ - SLASHKEY = 0x00e8, /* 232 */ - BACKSLASHKEY = 0x00e9, /* 233 */ - EQUALKEY = 0x00ea, /* 234 */ - LEFTBRACKETKEY = 0x00eb, /* 235 */ - RIGHTBRACKETKEY = 0x00ec, /* 236 */ - - F1KEY = 0x012c, /* 300 */ - F2KEY = 0x012d, /* 301 */ - F3KEY = 0x012e, /* 302 */ - F4KEY = 0x012f, /* 303 */ - F5KEY = 0x0130, /* 304 */ - F6KEY = 0x0131, /* 305 */ - F7KEY = 0x0132, /* 306 */ - F8KEY = 0x0133, /* 307 */ - F9KEY = 0x0134, /* 308 */ - F10KEY = 0x0135, /* 309 */ - F11KEY = 0x0136, /* 310 */ - F12KEY = 0x0137, /* 311 */ - F13KEY = 0x0138, /* 312 */ - F14KEY = 0x0139, /* 313 */ - F15KEY = 0x013a, /* 314 */ - F16KEY = 0x013b, /* 315 */ - F17KEY = 0x013c, /* 316 */ - F18KEY = 0x013d, /* 317 */ - F19KEY = 0x013e, /* 318 */ - F20KEY = 0x013f, /* 319 */ - F21KEY = 0x0140, /* 320 */ - F22KEY = 0x0141, /* 321 */ - F23KEY = 0x0142, /* 322 */ - F24KEY = 0x0143, /* 323 */ + EVT_ESCKEY = 0x00da, /* 218 */ + EVT_TABKEY = 0x00db, /* 219 */ + EVT_RETKEY = 0x00dc, /* 220 */ + EVT_SPACEKEY = 0x00dd, /* 221 */ + EVT_LINEFEEDKEY = 0x00de, /* 222 */ + EVT_BACKSPACEKEY = 0x00df, /* 223 */ + EVT_DELKEY = 0x00e0, /* 224 */ + EVT_SEMICOLONKEY = 0x00e1, /* 225 */ + EVT_PERIODKEY = 0x00e2, /* 226 */ + EVT_COMMAKEY = 0x00e3, /* 227 */ + EVT_QUOTEKEY = 0x00e4, /* 228 */ + EVT_ACCENTGRAVEKEY = 0x00e5, /* 229 */ + EVT_MINUSKEY = 0x00e6, /* 230 */ + EVT_PLUSKEY = 0x00e7, /* 231 */ + EVT_SLASHKEY = 0x00e8, /* 232 */ + EVT_BACKSLASHKEY = 0x00e9, /* 233 */ + EVT_EQUALKEY = 0x00ea, /* 234 */ + EVT_LEFTBRACKETKEY = 0x00eb, /* 235 */ + EVT_RIGHTBRACKETKEY = 0x00ec, /* 236 */ + + EVT_F1KEY = 0x012c, /* 300 */ + EVT_F2KEY = 0x012d, /* 301 */ + EVT_F3KEY = 0x012e, /* 302 */ + EVT_F4KEY = 0x012f, /* 303 */ + EVT_F5KEY = 0x0130, /* 304 */ + EVT_F6KEY = 0x0131, /* 305 */ + EVT_F7KEY = 0x0132, /* 306 */ + EVT_F8KEY = 0x0133, /* 307 */ + EVT_F9KEY = 0x0134, /* 308 */ + EVT_F10KEY = 0x0135, /* 309 */ + EVT_F11KEY = 0x0136, /* 310 */ + EVT_F12KEY = 0x0137, /* 311 */ + EVT_F13KEY = 0x0138, /* 312 */ + EVT_F14KEY = 0x0139, /* 313 */ + EVT_F15KEY = 0x013a, /* 314 */ + EVT_F16KEY = 0x013b, /* 315 */ + EVT_F17KEY = 0x013c, /* 316 */ + EVT_F18KEY = 0x013d, /* 317 */ + EVT_F19KEY = 0x013e, /* 318 */ + EVT_F20KEY = 0x013f, /* 319 */ + EVT_F21KEY = 0x0140, /* 320 */ + EVT_F22KEY = 0x0141, /* 321 */ + EVT_F23KEY = 0x0142, /* 322 */ + EVT_F24KEY = 0x0143, /* 323 */ /* *** End of keyboard codes. *** */ @@ -362,7 +358,8 @@ enum { /* test whether the event is a modifier key */ #define ISKEYMODIFIER(event_type) \ - (((event_type) >= LEFTCTRLKEY && (event_type) <= LEFTSHIFTKEY) || (event_type) == OSKEY) + (((event_type) >= EVT_LEFTCTRLKEY && (event_type) <= EVT_LEFTSHIFTKEY) || \ + (event_type) == EVT_OSKEY) /* test whether the event is a mouse button */ #define ISMOUSE(event_type) \ |